| @@ -1,21 +1,13 @@ |
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { |
| 3 | | Globe, |
| 4 | | List, |
| 5 | | LocateOff, |
| 6 | | Regex, |
| 7 | 3 | Settings, |
| 8 | | TextAlignStart, |
| 9 | 4 | X |
| 10 | 5 | } from 'lucide-vue-next' |
| 11 | 6 | import { ref } from 'vue' |
| 12 | | import { searchMode, showDetailedList } from '../../searchState' |
| 13 | | import type { SearchSortMode } from '../../searchState' |
| 14 | 7 | |
| 15 | 8 | defineProps<{ |
| 16 | 9 | filterText: string |
| 17 | 10 | searchLoading: boolean |
| 18 | | disableDetailedView: boolean |
| 19 | 11 | showSettingsPopup: boolean |
| 20 | 12 | buttonText: string |
| 21 | 13 | disableReset: boolean |
| @@ -26,7 +18,6 @@ defineProps<{ |
| 26 | 18 | |
| 27 | 19 | const emit = defineEmits<{ |
| 28 | 20 | 'update:filterText': [value: string] |
| 29 | | cycleSearchMode: [] |
| 30 | 21 | resetSearch: [] |
| 31 | 22 | searchBarClick: [event: PointerEvent] |
| 32 | 23 | toggleSettings: [] |
| @@ -37,29 +28,6 @@ const searchInput = ref<HTMLInputElement>() |
| 37 | 28 | const settingsButtonRef = ref<HTMLButtonElement>() |
| 38 | 29 | |
| 39 | 30 | defineExpose({ searchInput, settingsButtonRef }) |
| 40 | | |
| 41 | | function onViewDetailClick() { |
| 42 | | showDetailedList.value = true |
| 43 | | } |
| 44 | | |
| 45 | | function onViewListClick() { |
| 46 | | showDetailedList.value = false |
| 47 | | } |
| 48 | | |
| 49 | | function onExactClick() { |
| 50 | | if (searchMode.value === 'exact') emit('cycleSearchMode') |
| 51 | | else searchMode.value = 'exact' as SearchSortMode |
| 52 | | } |
| 53 | | |
| 54 | | function onFuzzyClick() { |
| 55 | | if (searchMode.value === 'fuzzy') emit('cycleSearchMode') |
| 56 | | else searchMode.value = 'fuzzy' as SearchSortMode |
| 57 | | } |
| 58 | | |
| 59 | | function onUrlClick() { |
| 60 | | if (searchMode.value === 'url') emit('cycleSearchMode') |
| 61 | | else searchMode.value = 'url' as SearchSortMode |
| 62 | | } |
| 63 | 31 | </script> |
| 64 | 32 | |
| 65 | 33 | <template> |
| @@ -118,58 +86,8 @@ function onUrlClick() { |
| 118 | 86 | alt="Bubba loading" |
| 119 | 87 | /> |
| 120 | 88 | </button> |
| 121 | | <div |
| 122 | | v-if="!disableDetailedView && searchMode !== 'url'" |
| 123 | | class="view-group toolbar-group" |
| 124 | | > |
| 125 | | <button |
| 126 | | type="button" |
| 127 | | class="mode-btn" |
| 128 | | :class="{ 'mode-active': showDetailedList }" |
| 129 | | title="Detail view (Consumes more RAM)" |
| 130 | | @click="onViewDetailClick" |
| 131 | | > |
| 132 | | <TextAlignStart :size="18" stroke-width="2" /> |
| 133 | | </button> |
| 134 | | <button |
| 135 | | type="button" |
| 136 | | class="mode-btn" |
| 137 | | :class="{ 'mode-active': !showDetailedList }" |
| 138 | | title="List view (Consumes less RAM)" |
| 139 | | @click="onViewListClick" |
| 140 | | > |
| 141 | | <List :size="18" stroke-width="2" /> |
| 142 | | </button> |
| 143 | | </div> |
| 144 | | <div class="search-mode-group toolbar-group"> |
| 145 | | <button |
| 146 | | type="button" |
| 147 | | class="mode-btn" |
| 148 | | :class="{ 'mode-active': searchMode === 'exact' }" |
| 149 | | title="Exact search" |
| 150 | | @click="onExactClick" |
| 151 | | > |
| 152 | | <Regex :size="18" stroke-width="2" /> |
| 153 | | </button> |
| 154 | | <button |
| 155 | | type="button" |
| 156 | | class="mode-btn" |
| 157 | | :class="{ 'mode-active': searchMode === 'fuzzy' }" |
| 158 | | title="Fuzzy search" |
| 159 | | @click="onFuzzyClick" |
| 160 | | > |
| 161 | | <LocateOff :size="18" stroke-width="2" /> |
| 162 | | </button> |
| 163 | | <button |
| 164 | | type="button" |
| 165 | | class="mode-btn" |
| 166 | | :class="{ 'mode-active': searchMode === 'url' }" |
| 167 | | title="URL search" |
| 168 | | @click="onUrlClick" |
| 169 | | > |
| 170 | | <Globe :size="18" stroke-width="2" /> |
| 171 | | </button> |
| 172 | | </div> |
| 89 | |
| 90 | |
| 173 | 91 | <button |
| 174 | 92 | ref="settingsButtonRef" |
| 175 | 93 | type="button" |
| @@ -291,8 +209,7 @@ function onUrlClick() { |
| 291 | 209 | padding: 8px; |
| 292 | 210 | } |
| 293 | 211 | |
| 294 | | .search-actions button:not([disabled]):hover, |
| 295 | | .toggle-layout-button.detailed-list { |
| 212 | .search-actions button:not([disabled]):hover { |
| 296 | 213 | color: var(--vp-c-brand-1); |
| 297 | 214 | } |
| 298 | 215 | |
| @@ -300,14 +217,7 @@ function onUrlClick() { |
| 300 | 217 | opacity: 0.37; |
| 301 | 218 | } |
| 302 | 219 | |
| 303 | | .toolbar-group + .toolbar-group { |
| 304 | | margin-left: 6px; |
| 305 | | } |
| 306 | 220 | |
| 307 | | .search-mode-group, |
| 308 | | .view-group { |
| 309 | | display: none; |
| 310 | | } |
| 311 | 221 | |
| 312 | 222 | .mode-btn { |
| 313 | 223 | display: flex; |
| @@ -322,10 +232,6 @@ function onUrlClick() { |
| 322 | 232 | border-radius: 0; |
| 323 | 233 | } |
| 324 | 234 | |
| 325 | | .mode-btn + .mode-btn { |
| 326 | | border-left: 1px solid var(--vp-c-divider); |
| 327 | | } |
| 328 | | |
| 329 | 235 | .mode-btn:hover { |
| 330 | 236 | color: var(--vp-c-text-1); |
| 331 | 237 | background: var(--vp-c-default-soft); |
| @@ -336,11 +242,7 @@ function onUrlClick() { |
| 336 | 242 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); |
| 337 | 243 | } |
| 338 | 244 | |
| 339 | | .exact-match-button.exact-match-active { |
| 340 | | color: var(--vp-c-brand-1); |
| 341 | | background-color: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); |
| 342 | | border-radius: 4px; |
| 343 | | } |
| 245 | |
| 344 | 246 | |
| 345 | 247 | .search-actions .settings-toggle-btn, |
| 346 | 248 | .search-actions .clear-button { |
| @@ -393,13 +295,16 @@ html.effects-disabled .clear-button:active { |
| 393 | 295 | display: none; |
| 394 | 296 | align-items: center; |
| 395 | 297 | justify-content: center; |
| 396 | | padding: 0; |
| 298 | padding: 8px; |
| 397 | 299 | border: none; |
| 398 | 300 | background: transparent; |
| 399 | 301 | color: var(--vp-c-text-1); |
| 400 | 302 | cursor: pointer; |
| 401 | | width: 24px; |
| 402 | | height: 24px; |
| 303 | transition: color 0.15s; |
| 304 | } |
| 305 | |
| 306 | .back-button:hover { |
| 307 | color: var(--vp-c-brand-1); |
| 403 | 308 | } |
| 404 | 309 | |
| 405 | 310 | @media (max-width: 767px) { |