Skip to content

Commit 5c123e5

Browse files
committed
feat(settings): Add header to all settings pages
1 parent 46d7947 commit 5c123e5

1 file changed

Lines changed: 42 additions & 31 deletions

File tree

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Fragment } from "react/jsx-runtime"
22
import { Route, Switch } from "wouter"
33

4-
import { VisuallyHidden } from "components/utility/visually-hidden"
54
import { cn } from "utils/cn"
65
import { hstack } from "utils/styles"
76

@@ -10,24 +9,39 @@ import { SettingsGeneral } from "./settings-general"
109
import { SettingsProjects } from "./settings-projects"
1110
import { SettingsTheming } from "./settings-theming"
1211

13-
const SectionHeader = ({ paths }: { paths: string[] }) => (
12+
const SectionHeader = ({ title }: { title: string }) => (
1413
<h2
1514
className={cn(
1615
hstack({ align: "center" }),
1716
"mt-4 mb-1 h-10 pl-2 text-2xl font-bold first-of-type:mt-6"
1817
)}
1918
>
20-
{paths.map((title, index) => (
21-
<Fragment key={title}>
22-
{index !== 0 && (
23-
<span className="after:mx-2 after:text-text-gentle after:content-['>']" />
24-
)}
25-
{title}
26-
</Fragment>
27-
))}
19+
<span className="opacity-25 after:mx-2 after:text-highlight after:content-['>']" />
20+
{title}
2821
</h2>
2922
)
3023

24+
const SettingsHeader = () => (
25+
<div className="@container mx-auto flex w-full max-w-2xl items-center justify-between px-10 pt-10 pb-6">
26+
<h1 className="text-[min(calc(15cqw),5rem)] font-bold text-highlight/15">
27+
Settings
28+
</h1>
29+
<div className="relative size-[min(5rem,25cqw)] shrink-0">
30+
<img
31+
className="absolute inset-0 min-h-full min-w-full opacity-75 blur-[3cqh]"
32+
src="./octopus.png"
33+
aria-hidden
34+
alt=""
35+
/>
36+
<img
37+
className="absolute inset-0 z-1 size-full drop-shadow-md"
38+
src="./octopus.png"
39+
alt="cute octopus emoji"
40+
/>
41+
</div>
42+
</div>
43+
)
44+
3145
export const settingPages = [
3246
{ path: "/general", title: "General", Component: SettingsGeneral },
3347
{ path: "/theming", title: "Theming", Component: SettingsTheming },
@@ -36,28 +50,25 @@ export const settingPages = [
3650
]
3751

3852
export const SettingsRoute = () => (
39-
<>
40-
<VisuallyHidden>
41-
<h1>Settings</h1>
42-
</VisuallyHidden>
43-
<div className="mx-auto w-full max-w-2xl pb-4">
44-
<Switch>
53+
<div className="mx-auto w-full max-w-2xl pb-4">
54+
<SettingsHeader />
55+
56+
<Switch>
57+
{settingPages.map(({ path, title, Component }) => (
58+
<Route key={path} path={path}>
59+
<SectionHeader title={title} />
60+
<Component />
61+
</Route>
62+
))}
63+
64+
<Route path="">
4565
{settingPages.map(({ path, title, Component }) => (
46-
<Route key={path} path={path}>
47-
<SectionHeader paths={["Settings", title]} />
66+
<Fragment key={path}>
67+
<SectionHeader title={title} />
4868
<Component />
49-
</Route>
69+
</Fragment>
5070
))}
51-
52-
<Route path="">
53-
{settingPages.map(({ path, title, Component }) => (
54-
<Fragment key={path}>
55-
<SectionHeader paths={["Settings", title]} />
56-
<Component />
57-
</Fragment>
58-
))}
59-
</Route>
60-
</Switch>
61-
</div>
62-
</>
71+
</Route>
72+
</Switch>
73+
</div>
6374
)

0 commit comments

Comments
 (0)