Skip to content

Commit 224c393

Browse files
Toby-Readae
authored andcommitted
feat: another overhaul (#59)
1 parent c187725 commit 224c393

20 files changed

+228
-1314
lines changed

src/app.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
@layer base {
44
:root {
55
--foreground: 248, 8%, 20%;
6-
--subtle: 248, 8%, 20%;
7-
--background: 0, 0%, 97%;
8-
--primary: 205, 67%, 40%;
9-
--primary-darker: 208, 65%, 50%;
6+
--subtle: 0, 1%, 33%;
7+
--background: 0, 0%, 100%;
8+
--primary: 208, 65%, 55%;
9+
--primary-darker: 208, 65%, 52%;
1010
--scrollbar-thumb: var(--subtle);
1111
--scrollbar-track: var(--background);
1212
}
@@ -16,8 +16,7 @@
1616
--foreground: 0, 0%, 100%;
1717
--subtle: 0, 0%, 85%;
1818
--background: 0, 0%, 3%;
19-
--primary: 205, 67%, 70%;
20-
--primary-darker: 208, 65%, 60%;
19+
--primary: 205, 67%, 62%;
2120
}
2221
}
2322

@@ -37,6 +36,7 @@
3736
--color-secondary: #968ca8;
3837
--color-neutral: hsla(var(--foreground), 70%);
3938
--color-error: #ff5449;
39+
--color-subtle-surface: hsla(var(--subtle), 8%);
4040
}
4141

4242
html {

src/lib/components/common/AdvantageCard.svelte

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/lib/components/common/DualHeader.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
const id = $derived(title.toLowerCase().replace(/\s/g, '-'));
1212
</script>
1313

14-
<hgroup
15-
class="my-12 mx-auto w-full flex flex-col text-center left items-center justify-center gap-4 px-4 md:max-w-[820px] scroll-mt-32 @container"
16-
>
17-
<h2 {id} class="text-[max(6cqw,_1.875em)] font-semibold capitalize leading-none">{title}</h2>
18-
<div class="text-[max(2.5cqw,_1em)] text-subtle leading-snug">
14+
<hgroup class="relative mx-auto text-center md:max-w-2xl mt-12 mb-16 md:mb-24 scroll-mt-24">
15+
<h2 {id} class="text-[2.5rem] leading-[135%] tracking-tight font-semibold capitalize">{title}</h2>
16+
<div class="text-xl text-subtle leading-[135%] mt-3 font-medium">
1917
{@render subtitle()}
2018
</div>
2119
</hgroup>

src/lib/components/common/LinkCard.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212

1313
<a
1414
{href}
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
class="group space-y-10 px-9 py-6 hover:bg-linear-to-r from-secondary/90 to-primary/90"
15+
class="group flex flex-col justify-between px-9 py-6 hover:bg-subtle-surface rounded-lg border border-subtle/12"
1816
>
19-
<div class="flex items-start justify-between">
17+
<div class="flex items-start justify-between mb-5">
2018
<h3 class="flex flex-row items-center text-2xl capitalize font-medium">
2119
{title}&nbsp;&nbsp;&nbsp;<img
2220
src="{base}/icons/link-arrow.svg"

src/lib/components/core/Navigation.svelte

Lines changed: 78 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,41 @@
1313
{ text: 'Add-Ons', href: 'https://ankiweb.net/shared/addons' },
1414
{ text: 'Shared Decks', href: 'https://ankiweb.net/shared/decks' },
1515
];
16+
17+
let scrollY = $state(0);
18+
19+
let isMenuOpen = $state(false);
20+
const toggleMenu = () => {
21+
isMenuOpen = !isMenuOpen;
22+
};
23+
const closeMenu = () => {
24+
isMenuOpen = false;
25+
};
1626
</script>
1727

18-
<header
19-
class="bg-background/90 backdrop-blur-lg sticky inset-x-0 top-0 z-10 border-b border-foreground/[13%]"
20-
>
21-
<div class="max-w-348 mx-auto">
22-
<div class="flex h-16 items-center justify-between gap-8 px-6">
28+
<svelte:window bind:scrollY />
29+
30+
<header class="fixed top-0 left-0 right-0 z-50">
31+
<div
32+
class="mx-auto w-full max-w-[1082px] px-6 md:px-12 flex items-center transition-all duration-500 ease-[linear(0,_0.178_4.5%,_0.336_9%,_0.477_13.6%,_0.604_18.4%,_0.713_23.3%,_0.762_25.8%,_0.806_28.3%,_0.847_30.9%,_0.884_33.5%,_0.917_36.2%,_0.946_38.9%,_0.969_41.3%,_0.989_43.8%,_1.006_46.4%,_1.02_49%,_1.032_51.7%,_1.041_54.5%,_1.048_57.3%,_1.051_60.3%,_1.053_65%,_1.048_70.2%,_1.039_75.7%,_1.008_91%,_1.002_95.7%,_1)] border-subtle/12 bg-background"
33+
class:pt-1={scrollY < 12}
34+
class:md:pt-6={scrollY < 12}
35+
class:border-b={scrollY > 6}
36+
>
37+
<div class="flex h-14 items-center justify-between w-full">
2338
<div class="flex gap-4">
2439
<a
2540
href="#top"
26-
class="flex items-center gap-2 shrink-0 [&>*]:pointer-events-none [&>*]:select-none"
41+
class="flex items-center gap-1.5 shrink-0 [&>*]:pointer-events-none [&>*]:select-none"
2742
>
28-
<img src="{base}/logo.svg" alt="Logo" class="size-7" />
29-
<span class="font-bold text-foreground text-xl leading-none tracking-widest"> Anki </span>
43+
<img src="{base}/logo.svg" alt="Logo" class="size-6" />
44+
<span class="font-semibold text-foreground text-xl tracking-wide">Anki</span>
3045
</a>
3146
</div>
3247
<div class="flex items-center h-full max-[832px]:hidden pr-8">
3348
{#each options as { text, href }}
3449
<a
3550
class="px-3 select-none transition-all duration-150 ease-out flex items-center text-foreground h-full hover:shadow-[inset_0_-2px_var(--color-primary)]"
36-
target="_blank"
37-
rel="noopener noreferrer"
3851
{href}
3952
>
4053
{text}
@@ -43,9 +56,7 @@
4356
<a
4457
aria-label="GitHub repository"
4558
href="https://github.com/ankitects/anki"
46-
target="_blank"
47-
rel="noopener noreferrer"
48-
class="px-3 py-2 group"
59+
class="px-3 py-2 group pr-6"
4960
>
5061
<svg viewBox="0 0 20 20" class="size-5 fill-foreground group-hover:fill-primary">
5162
<path
@@ -56,7 +67,7 @@
5667
</a>
5768
<a
5869
href="#downloads"
59-
class="ml-3 rounded hover:opacity-80 bg-gradient-to-r from-primary-darker to-primary text-background h-12 flex items-center px-4 font-bold leading-none cursor-pointer transition-all duration-300 ease-out"
70+
class="rounded-[2rem] px-4 py-1.5 font-semibold tracking-tight transition-all duration-100 ease-out bg-gradient-to-r from-primary-darker to-primary text-background hover:opacity-80"
6071
>
6172
Download Anki
6273
</a>
@@ -66,7 +77,7 @@
6677
type="button"
6778
class="relative inline-grid size-7 place-items-center rounded-md text-foreground"
6879
aria-label="Navigation"
69-
popovertarget="menu"
80+
onclick={toggleMenu}
7081
>
7182
<svg
7283
xmlns="http://www.w3.org/2000/svg"
@@ -81,63 +92,61 @@
8192
/>
8293
</svg>
8394
</button>
84-
<div
85-
id="menu"
86-
popover="auto"
87-
role="menu"
88-
class="fixed top-0 left-0 size-full bg-background z-20 p-20"
89-
>
90-
<button
91-
popovertarget="menu"
92-
popovertargetaction="hide"
93-
aria-label="Close menu"
94-
class="text-foreground absolute top-6 right-6"
95+
{#if isMenuOpen}
96+
<div
97+
id="menu"
98+
role="menu"
99+
class="fixed top-0 left-0 size-full bg-background z-20 p-20 menu-open"
95100
>
96-
<svg
97-
xmlns="http://www.w3.org/2000/svg"
98-
viewBox="0 0 24 24"
99-
fill="currentColor"
100-
class="size-8"
101+
<button
102+
onclick={closeMenu}
103+
aria-label="Close menu"
104+
class="text-foreground absolute top-6 right-6"
101105
>
102-
<path
103-
fill-rule="evenodd"
104-
d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z"
105-
clip-rule="evenodd"
106-
/>
107-
</svg>
108-
</button>
109-
<nav class="flex flex-col gap-4 h-full">
110-
{#each options as { text, href }}
111-
<a
112-
class="w-fit select-none transition-all gap-1 duration-150 ease-out text-3xl flex items-center text-foreground hover:shadow-[inset_0_-2px_#7EBBE5]"
113-
{href}
106+
<svg
107+
xmlns="http://www.w3.org/2000/svg"
108+
viewBox="0 0 24 24"
109+
fill="currentColor"
110+
class="size-8"
114111
>
115-
{text}
116-
<svg
117-
xmlns="http://www.w3.org/2000/svg"
118-
viewBox="0 0 16 16"
119-
fill="currentColor"
120-
class="size-8"
112+
<path
113+
fill-rule="evenodd"
114+
d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z"
115+
clip-rule="evenodd"
116+
/>
117+
</svg>
118+
</button>
119+
<nav class="flex flex-col gap-4 h-full">
120+
{#each options as { text, href }}
121+
<a
122+
class="w-fit select-none transition-all gap-1 duration-150 ease-out text-3xl flex items-center text-foreground hover:shadow-[inset_0_-2px_#7EBBE5]"
123+
{href}
121124
>
122-
<path
123-
fill-rule="evenodd"
124-
d="M4.22 11.78a.75.75 0 0 1 0-1.06L9.44 5.5H5.75a.75.75 0 0 1 0-1.5h5.5a.75.75 0 0 1 .75.75v5.5a.75.75 0 0 1-1.5 0V6.56l-5.22 5.22a.75.75 0 0 1-1.06 0Z"
125-
clip-rule="evenodd"
126-
/>
127-
</svg>
125+
{text}
126+
<svg
127+
xmlns="http://www.w3.org/2000/svg"
128+
viewBox="0 0 16 16"
129+
fill="currentColor"
130+
class="size-8"
131+
>
132+
<path
133+
fill-rule="evenodd"
134+
d="M4.22 11.78a.75.75 0 0 1 0-1.06L9.44 5.5H5.75a.75.75 0 0 1 0-1.5h5.5a.75.75 0 0 1 .75.75v5.5a.75.75 0 0 1-1.5 0V6.56l-5.22 5.22a.75.75 0 0 1-1.06 0Z"
135+
clip-rule="evenodd"
136+
/>
137+
</svg>
138+
</a>
139+
{/each}
140+
<a
141+
href="#downloads"
142+
onclick={closeMenu}
143+
class="text-center mt-auto rounded hover:opacity-80 bg-gradient-to-r from-primary-darker to-primary text-background py-4 text-lg flex items-center justify-center font-semibold leading-none cursor-pointer transition-all duration-300 ease-out"
144+
>
145+
Download Anki
128146
</a>
129-
{/each}
130-
<a
131-
href="#downloads"
132-
onclick={() => {
133-
document.getElementById('menu')?.hidePopover();
134-
}}
135-
class="text-center mt-auto rounded hover:opacity-80 bg-gradient-to-r from-primary-darker to-primary text-background py-4 text-lg flex items-center justify-center font-semibold leading-none cursor-pointer transition-all duration-300 ease-out"
136-
>
137-
Download Anki
138-
</a>
139-
</nav>
140-
</div>
147+
</nav>
148+
</div>
149+
{/if}
141150
</div>
142151
</div>
143152
</div>
@@ -152,9 +161,7 @@
152161
opacity: 1;
153162
}
154163
}
155-
#menu {
156-
&:popover-open {
157-
animation: fadeIn 0.3s forwards ease-in;
158-
}
164+
.menu-open {
165+
animation: fadeIn 0.3s forwards ease-in;
159166
}
160167
</style>

0 commit comments

Comments
 (0)