From cdc70403f9f1463f45637dcf91969639810bea71 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sun, 7 Dec 2025 16:32:24 +0100 Subject: [PATCH] refactor: Move search modal to layout root for proper z-index stacking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Extract SearchModal component from SearchBar for root-level rendering - Add isModalOpen state to search store with open/close methods - Simplify SearchBar to trigger button only - Update Modal with proper overflow handling and scroll-to-close - Fix layout background to use void color 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/lib/components/layout/SearchBar.svelte | 106 ++------------ src/lib/components/layout/SearchModal.svelte | 146 +++++++++++++++++++ src/lib/components/ui/Modal.svelte | 26 ++-- src/lib/stores/search.ts | 12 ++ src/routes/+layout.svelte | 6 +- 5 files changed, 189 insertions(+), 107 deletions(-) create mode 100644 src/lib/components/layout/SearchModal.svelte diff --git a/src/lib/components/layout/SearchBar.svelte b/src/lib/components/layout/SearchBar.svelte index 6e8ea4c..9ac0bbc 100644 --- a/src/lib/components/layout/SearchBar.svelte +++ b/src/lib/components/layout/SearchBar.svelte @@ -1,116 +1,30 @@ - - - -
-
- -
- - - {#if $search.recentSearches.length > 0} -
-
-

Recent Searches

- -
-
- {#each $search.recentSearches as recent} - - {/each} -
-
- {/if} - - -
-

Search Tips

-
    -
  • • Search by player name or Steam ID
  • -
  • • Enter share code to find specific match
  • -
  • • Use map name to filter matches (e.g., "de_dust2")
  • -
-
-
-
diff --git a/src/lib/components/layout/SearchModal.svelte b/src/lib/components/layout/SearchModal.svelte new file mode 100644 index 0000000..eff44f0 --- /dev/null +++ b/src/lib/components/layout/SearchModal.svelte @@ -0,0 +1,146 @@ + + + + +{#if $search.isModalOpen} +
{ + if (e.key === 'Escape') handleClose(); + }} + role="dialog" + aria-modal="true" + aria-label="Search" + tabindex="-1" + > + +
+ + +
+ +
+
+ +
+ + + {#if $search.recentSearches.length > 0} +
+
+

Recent Searches

+ +
+
+ {#each $search.recentSearches as recent} + + {/each} +
+
+ {/if} + + +
+

Search Tips

+
    +
  • Search by player name or Steam ID
  • +
  • Enter share code to find specific match
  • +
  • Use map name to filter matches (e.g., "de_dust2")
  • +
+
+
+
+
+{/if} diff --git a/src/lib/components/ui/Modal.svelte b/src/lib/components/ui/Modal.svelte index 595a3f8..c125fbf 100644 --- a/src/lib/components/ui/Modal.svelte +++ b/src/lib/components/ui/Modal.svelte @@ -39,11 +39,16 @@ }; - + { + if (open) handleClose(); + }} +/> {#if open}
{ @@ -57,19 +62,22 @@ tabindex="-1" > -
+
{#if title} -
- +
+
{:else}