11import React from "react" ;
22import styled from "styled-components" ;
3- import { NavLink , useNavigate , useLocation } from "react-router-dom" ;
3+ import { useNavigate , useLocation } from "react-router-dom" ;
44import { AppContext } from "~components/AppContext" ;
5- import { SearchBox , SearchInput } from "~components/Search" ;
6- import { SidebarFilterContext } from "~components/layout/SidebarFilterContext" ;
5+ import { SearchBox } from "~components/Search" ;
76import { GAMES , GameId , getGame } from "~games" ;
87
9- export const NavBar = ( { baseUrl, game } : { baseUrl ?: string ; game ?: GameId } ) => {
8+ export const NavBar = ( { baseUrl } : { baseUrl ?: string } ) => {
109 if ( ! baseUrl ) {
1110 return (
1211 < NavBarSimple >
13- < HomeBrandLink to = "/cs2" > Source 2 Schemas</ HomeBrandLink >
1412 < NavBarThemeSwitcher />
1513 </ NavBarSimple >
1614 ) ;
1715 }
1816
19- return < NavBarWithSearch baseUrl = { baseUrl } game = { game } /> ;
20- } ;
21-
22- function NavBarWithSearch ( { baseUrl, game } : { baseUrl : string ; game ?: GameId } ) {
23- const { filter, setFilter } = React . useContext ( SidebarFilterContext ) ;
24-
2517 return (
26- < >
27- < NavBarSidebarCell >
28- < SidebarSearchInput
29- placeholder = "Filter sidebar..."
30- value = { filter }
31- onChange = { ( e ) => setFilter ( e . target . value ) }
32- />
33- </ NavBarSidebarCell >
34- < NavBarContentCell >
35- < NavBarSearchBox baseUrl = { baseUrl } placeholder = "Search... (module: or offset: to filter)" />
36- { game && < GameSwitcher currentGame = { game } /> }
37- < HomeBrandLink to = "/cs2" > Source 2 Schemas</ HomeBrandLink >
38- < NavBarThemeSwitcher />
39- </ NavBarContentCell >
40- </ >
18+ < NavBarContentCell >
19+ < NavBarSearchBox baseUrl = { baseUrl } placeholder = "Search... (module: or offset: to filter)" />
20+ < NavBarThemeSwitcher />
21+ </ NavBarContentCell >
4122 ) ;
42- }
23+ } ;
4324
44- function GameSwitcher ( { currentGame } : { currentGame : GameId } ) {
25+ export function GameSwitcher ( { currentGame } : { currentGame : GameId } ) {
4526 const [ open , setOpen ] = React . useState ( false ) ;
4627 const ref = React . useRef < HTMLDivElement > ( null ) ;
4728 const navigate = useNavigate ( ) ;
@@ -71,10 +52,10 @@ function GameSwitcher({ currentGame }: { currentGame: GameId }) {
7152 return (
7253 < SwitcherWrapper ref = { ref } >
7354 < SwitcherToggle onClick = { ( ) => setOpen ( ! open ) } title = { currentGameInfo ?. name } >
74- < SwitcherIcon > { currentGameInfo ?. icon } </ SwitcherIcon >
7555 < SwitcherChevron viewBox = "0 0 24 24" width = "14" height = "14" fill = "none" stroke = "currentColor" strokeWidth = "2" strokeLinecap = "round" strokeLinejoin = "round" >
7656 < path d = "m6 9 6 6 6-6" />
7757 </ SwitcherChevron >
58+ < SwitcherIcon > { currentGameInfo ?. icon } </ SwitcherIcon >
7859 </ SwitcherToggle >
7960 { open && (
8061 < SwitcherDropdown >
@@ -120,8 +101,8 @@ const SwitcherIcon = styled.span`
120101
121102 svg {
122103 display: block;
123- width: 37px ;
124- height: 37px ;
104+ width: 28px ;
105+ height: 28px ;
125106 }
126107` ;
127108
@@ -132,13 +113,13 @@ const SwitcherChevron = styled.svg`
132113const SwitcherDropdown = styled . div `
133114 position: absolute;
134115 top: 100%;
135- left : 0;
116+ right : 0;
136117 margin-top: 4px;
137118 background: ${ ( props ) => props . theme . group } ;
138119 border: 1px solid ${ ( props ) => props . theme . groupBorder } ;
139120 border-radius: 8px;
140121 box-shadow: ${ ( props ) => props . theme . groupShadow } ;
141- z-index: 100 ;
122+ z-index: 200 ;
142123 overflow: hidden;
143124 min-width: 200px;
144125` ;
@@ -161,44 +142,21 @@ const SwitcherOption = styled.button<{ $active: boolean }>`
161142 }
162143` ;
163144
164- const NavBarCell = styled . div `
165- grid-row: 1;
145+ const NavBarContentCell = styled . div `
166146 display: flex;
167147 align-items: center;
168- ` ;
169-
170- const NavBarSidebarCell = styled ( NavBarCell ) `
171- grid-column: 1;
172- padding: 10px 14px;
173- background-color: ${ ( props ) => props . theme . sidebar } ;
174- position: sticky;
175- top: 0;
176- z-index: 10;
177-
178- @media (max-width: 768px) {
179- display: none;
180- }
181- ` ;
182-
183- const NavBarContentCell = styled ( NavBarCell ) `
184- grid-column: 2;
185148 gap: 14px;
186149 padding: 10px 14px 10px 24px;
187150 min-width: 0;
151+ flex-shrink: 0;
188152 background-color: ${ ( props ) => props . theme . background } ;
189- position: sticky;
190- top: 0;
191- z-index: 10;
192153
193154 @media (max-width: 768px) {
194155 grid-column: 1;
195156 padding: 10px 14px;
196157 }
197158` ;
198159
199- const SidebarSearchInput = styled ( SearchInput ) `
200- background: ${ ( props ) => props . theme . background } ;
201- ` ;
202160
203161const NavBarSearchBox = styled ( SearchBox ) `
204162 flex: 1;
@@ -216,21 +174,6 @@ const NavBarSimple = styled.nav`
216174 background-color: ${ ( props ) => props . theme . background } ;
217175` ;
218176
219- const HomeBrandLink = styled ( NavLink ) `
220- font-weight: 600;
221- font-size: 16px;
222- letter-spacing: -0.01em;
223- text-decoration: none;
224- color: ${ ( props ) => props . theme . textDim } ;
225- white-space: nowrap;
226- flex-shrink: 0;
227- transition: color 0.15s;
228-
229- &:hover {
230- color: ${ ( props ) => props . theme . text } ;
231- }
232- ` ;
233-
234177const ToggleTrack = styled . label < { $active : boolean } > `
235178 display: flex;
236179 align-items: center;
@@ -276,6 +219,30 @@ const ToggleLabelRight = styled(ToggleLabel)`
276219 right: 5px;
277220` ;
278221
222+ export function S2VLogo ( ) {
223+ return (
224+ < svg viewBox = "0 0 160 160" width = "28" height = "28" >
225+ < circle cx = "75.25" cy = "72.75" r = "64.58" fill = "#242a40" />
226+ < path
227+ fill = "#458fff"
228+ d = "M143.69 21.16q0 1.04-.12 2.04s-4.59 27.94-7.58 45.96c-.5 3.03-1.46 9.4-1.66 10.01v.02a7.06 7.06 0 0 1-9.48 4.27 6.8 6.8 0 0 1-4.18-6.39v-.08c0-.38.21-3.16.22-4.18a48 48 0 0 0-.25-4.82 44 44 0 0 0-1.58-8.09 45.7 45.7 0 0 0-38.68-32.5 47 47 0 0 0-5.07-.29c-.84 0-4.1.21-4.19.19a7 7 0 0 1-1.68-13.74c.46-.14 6.66-1.18 9.68-1.72 18.25-3.24 44.55-7.88 44.55-7.88a17.3 17.3 0 0 1 11.74 2.35 17.4 17.4 0 0 1 8.29 14.83Z"
229+ />
230+ < path
231+ fill = "#385283"
232+ d = "M132.81 87.2q-.22.88-.46 1.75a58 58 0 0 1-3.85 9.98c-.68 1.27-2.45 4.5-3.65 6.42a60 60 0 0 1-10.27 11.84s6.76 18.06 7.05 19.22q.5 1.94.5 4.05a16.6 16.6 0 0 1-16.66 16.61 16.6 16.6 0 0 1-13.92-7.56c-.37-.55-10.13-17.74-10.13-17.74q-4.34.46-8.84.26c-29.95-1.32-54.48-25.23-56.5-55.13a59.2 59.2 0 0 1 20.11-48.78 56 56 0 0 1 8.23-6.05 58 58 0 0 1 16.79-6.97 11.42 11.42 0 0 0 2.33 13.52c-4.7 1.15-12.04 3.47-18.94 10.35-9.78 9.76-16.33 23.06-14.72 38.42 2.35 22.4 20.95 40.03 43.46 40.95l.43.01a45.5 45.5 0 0 0 39.4-20.18c1.43-2.08 4.97-8.87 6.06-13.09l.08-.33a11.4 11.4 0 0 0 13.53 2.45Z"
233+ />
234+ < path
235+ fill = "#edf3fc"
236+ d = "M95.73 68.92q5.22 2.91 7.4 9.5a20 20 0 0 1 .33 11.94 23 23 0 0 1-6.4 10.5 29 29 0 0 1-11.44 6.71A28 28 0 0 1 72 108.65a24 24 0 0 1-11.36-5.05c-2.46-2-4.34-4.73-5.5-6.92a8 8 0 0 1-.79-1.99 7.5 7.5 0 0 1 4.93-8.87 7.3 7.3 0 0 1 7.31 1.74l.11.12c.46.47 1.38 1.88 1.46 2.02a12.4 12.4 0 0 0 5.41 4.72q3.49 1.63 7.91.21c4.42-1.42 5.04-2.47 6.5-4.66a8 8 0 0 0 .91-7.22q-.9-2.77-3.51-3.34c-1.74-.38-10.38-.46-10.94-.46-.45 0-8.67.03-11.77-.26A25 25 0 0 1 52.6 75.3q-5.1-2.91-7.08-9.41a19 19 0 0 1-.02-11.59 23 23 0 0 1 6.41-10.04q4.63-4.35 11.11-6.41c6.48-2.06 8.91-1.83 13.17-1.14a24 24 0 0 1 11.11 4.67 22 22 0 0 1 5.51 6.58 9 9 0 0 1 .82 1.92 7.16 7.16 0 0 1-4.77 8.65c-2.63.84-5.4.11-7.28-1.67l-.11-.12a18 18 0 0 1-1.46-1.96q-1.92-3-5.34-4.54-3.41-1.53-7.74-.16c-4.33 1.37-4.94 2.4-6.39 4.52a7.7 7.7 0 0 0-.98 7.02q.86 2.7 3.42 3.27c1.71.37 10.28.44 10.84.43.45 0 8.64-.05 11.74.23q4.96.45 10.17 3.36Z"
237+ />
238+ < path
239+ fill = "#242a40"
240+ d = "M137.85 33.08c.21.71.26 1.89-.03 2.48a2.3 2.3 0 0 1-1.44 1.23l-14.56 4.05c-4.59.83-6.59-2.59-5.54-5.66s9.05-15.2 9.55-15.77 1.03-1.54.78-2.4a3.8 3.8 0 0 0-2.08-2.54 4.6 4.6 0 0 0-3.33-.2 4.2 4.2 0 0 0-2.64 1.98 6 6 0 0 0-.72 3.12c0 .07.02.84-.02 1.14l-.01.07a3.1 3.1 0 0 1-2.11 2.47c-1.56.45-3.22-.55-3.79-2.25l-.07-.21a11.23 11.23 0 0 1 .16-4.72 10.72 10.72 0 0 1 7.53-7.41q2.76-.8 5.43-.22 2.69.57 4.71 2.38a10 10 0 0 1 2.86 4.59c.62 2.04.64 4.09-.05 5.7s-8.63 12.3-8.45 12.91l10.66-2.94c.79-.23 1.62 0 2.24.55a4 4 0 0 1 .93 1.62Z"
241+ />
242+ </ svg >
243+ ) ;
244+ }
245+
279246function NavBarThemeSwitcher ( ) {
280247 const appContext = React . useContext ( AppContext ) ;
281248
0 commit comments