From 02047a0104602439b4b22b6b7ae3d6d28ffa8bd5 Mon Sep 17 00:00:00 2001 From: Ben <45583362+ben-basten@users.noreply.github.com> Date: Tue, 10 Sep 2024 00:12:26 -0400 Subject: [PATCH] feat(web): move search options into a modal (#12438) * feat(web): move search options into a modal * chore: revert adding focus ring * minor styling --------- Co-authored-by: Alex Tran --- .../full-screen-modal.svelte | 31 ++++++++++---- .../shared-components/modal-header.svelte | 2 +- .../search-bar/search-bar.svelte | 8 ++-- ...-box.svelte => search-filter-modal.svelte} | 42 ++++++++----------- .../search-bar/search-media-section.svelte | 2 +- web/src/lib/i18n/en.json | 1 + 6 files changed, 46 insertions(+), 40 deletions(-) rename web/src/lib/components/shared-components/search-bar/{search-filter-box.svelte => search-filter-modal.svelte} (83%) diff --git a/web/src/lib/components/shared-components/full-screen-modal.svelte b/web/src/lib/components/shared-components/full-screen-modal.svelte index 228d560cab..2cecdf74e8 100644 --- a/web/src/lib/components/shared-components/full-screen-modal.svelte +++ b/web/src/lib/components/shared-components/full-screen-modal.svelte @@ -22,7 +22,7 @@ * - `narrow`: 28rem * - `auto`: fits the width of the modal content, up to a maximum of 32rem */ - export let width: 'wide' | 'narrow' | 'auto' = 'narrow'; + export let width: 'extra-wide' | 'wide' | 'narrow' | 'auto' = 'narrow'; /** * Unique identifier for the modal. @@ -34,12 +34,25 @@ let modalWidth: string; $: { - if (width === 'wide') { - modalWidth = 'w-[48rem]'; - } else if (width === 'narrow') { - modalWidth = 'w-[28rem]'; - } else { - modalWidth = 'sm:max-w-4xl'; + switch (width) { + case 'extra-wide': { + modalWidth = 'w-[56rem]'; + break; + } + + case 'wide': { + modalWidth = 'w-[48rem]'; + break; + } + + case 'narrow': { + modalWidth = 'w-[28rem]'; + break; + } + + default: { + modalWidth = 'sm:max-w-4xl'; + } } } @@ -62,7 +75,7 @@ aria-labelledby={titleId} >
@@ -72,7 +85,7 @@
{#if isStickyBottom}
diff --git a/web/src/lib/components/shared-components/modal-header.svelte b/web/src/lib/components/shared-components/modal-header.svelte index 8c81cebe1a..efd87b476c 100644 --- a/web/src/lib/components/shared-components/modal-header.svelte +++ b/web/src/lib/components/shared-components/modal-header.svelte @@ -26,7 +26,7 @@ {#if showLogo} {:else if icon} - + {/if}

{title} diff --git a/web/src/lib/components/shared-components/search-bar/search-bar.svelte b/web/src/lib/components/shared-components/search-bar/search-bar.svelte index 07d4df6e66..b0bbdbe71f 100644 --- a/web/src/lib/components/shared-components/search-bar/search-bar.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-bar.svelte @@ -4,7 +4,7 @@ import { isSearchEnabled, preventRaceConditionSearchBar, savedSearchTerms } from '$lib/stores/search.store'; import { mdiClose, mdiMagnify, mdiTune } from '@mdi/js'; import SearchHistoryBox from './search-history-box.svelte'; - import SearchFilterBox from './search-filter-box.svelte'; + import SearchFilterModal from './search-filter-modal.svelte'; import type { MetadataSearchDto, SmartSearchDto } from '@immich/sdk'; import { getMetadataSearchQuery } from '$lib/utils/metadata-search'; import { handlePromiseError } from '$lib/utils'; @@ -160,8 +160,8 @@ id="main-search-bar" class="w-full transition-all border-2 px-14 py-4 text-immich-fg/75 dark:text-immich-dark-fg {grayTheme ? 'dark:bg-immich-dark-gray' : 'dark:bg-immich-dark-bg'} - {(showSuggestions && isSearchSuggestions) || showFilter ? 'rounded-t-3xl' : 'rounded-3xl bg-gray-200'} - {$isSearchEnabled ? 'border-gray-200 dark:border-gray-700 bg-white' : 'border-transparent'}" + {showSuggestions && isSearchSuggestions ? 'rounded-t-3xl' : 'rounded-3xl bg-gray-200'} + {$isSearchEnabled && !showFilter ? 'border-gray-200 dark:border-gray-700 bg-white' : 'border-transparent'}" placeholder={$t('search_your_photos')} required pattern="^(?!m:$).*$" @@ -215,6 +215,6 @@ {#if showFilter} - onSearch(detail)} /> + onSearch(payload)} onClose={() => (showFilter = false)} /> {/if} diff --git a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte b/web/src/lib/components/shared-components/search-bar/search-filter-modal.svelte similarity index 83% rename from web/src/lib/components/shared-components/search-bar/search-filter-box.svelte rename to web/src/lib/components/shared-components/search-bar/search-filter-modal.svelte index 45e9393ed4..3ec539ad97 100644 --- a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-filter-modal.svelte @@ -24,8 +24,6 @@ -
-
-
+ + +
@@ -147,7 +142,7 @@ -
+
@@ -155,13 +150,10 @@
- -
- - -
-
+ + + + + +
diff --git a/web/src/lib/components/shared-components/search-bar/search-media-section.svelte b/web/src/lib/components/shared-components/search-bar/search-media-section.svelte index ce43dd0141..b78868d614 100644 --- a/web/src/lib/components/shared-components/search-bar/search-media-section.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-media-section.svelte @@ -1,6 +1,6 @@