Skip to content

Commit 8828782

Browse files
committed
Change header and toolbar pinning design
1 parent a34a9c7 commit 8828782

File tree

2 files changed

+19
-28
lines changed

2 files changed

+19
-28
lines changed

frontend/src/App.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import { toolbarPinnedAtom } from "./atoms.ts";
1414
export function App() {
1515
return (
1616
<main className="flex flex-col items-center">
17-
<a href="#" className="font-fancy m-8 text-center text-5xl md:text-6xl">
18-
<h1>Ma'at</h1>
19-
</a>
17+
<Header />
2018
<ErrorBoundary FallbackComponent={Fallback}>
2119
<Suspense fallback={<Loading />}>
2220
<ToolbarContainer />
@@ -47,19 +45,31 @@ function Fallback({ error }: FallbackProps) {
4745
);
4846
}
4947

50-
function ToolbarContainer() {
48+
function Header() {
5149
const toolbarPinned = useAtomValue(toolbarPinnedAtom);
5250
return (
53-
<div
51+
<a
52+
href="#"
5453
className={clsx(
55-
"flex w-full flex-col items-center",
56-
toolbarPinned && "scroll-state sticky top-0 z-10",
54+
"font-fancy z-11 w-full p-8 text-center text-5xl md:text-6xl",
55+
toolbarPinned && "bg-base-100",
5756
)}
57+
>
58+
<h1>Ma'at</h1>
59+
</a>
60+
);
61+
}
62+
63+
function ToolbarContainer() {
64+
const toolbarPinned = useAtomValue(toolbarPinnedAtom);
65+
return (
66+
<div
67+
className={clsx("flex w-full flex-col items-center", toolbarPinned && "sticky top-0 z-10")}
5868
>
5969
<nav
6070
className={clsx(
61-
"border-base-300 bg-base-100 toolbar-card mx-4 flex flex-col items-center rounded-(--radius-box) border p-4 transition",
62-
"stuck-top:border-t-base-100 stuck-top:border-x-base-100 stuck-top:w-full stuck-top:rounded-none stuck-top:px-8 stuck-top:shadow-lg",
71+
"border-base-300 bg-base-100 toolbar-card mx-4 flex flex-col items-center rounded-(--radius-box) border p-4",
72+
toolbarPinned && "border-t-base-100 border-x-base-100 w-full rounded-none px-8",
6373
)}
6474
>
6575
<Toolbar />

frontend/src/style.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,3 @@
99
:root {
1010
@apply bg-base-200;
1111
}
12-
13-
@utility scroll-state {
14-
@supports (container-type: scroll-state) {
15-
& {
16-
container-type: scroll-state;
17-
}
18-
}
19-
}
20-
21-
/* FIXME: Doesn't work on prod due to https://github.com/parcel-bundler/lightningcss/issues/887 */
22-
@custom-variant stuck-top {
23-
@supports (container-type: scroll-state) {
24-
@container scroll-state(stuck: top) {
25-
&.flex {
26-
@slot;
27-
}
28-
}
29-
}
30-
}

0 commit comments

Comments
 (0)