Skip to content

Commit b33abb4

Browse files
committed
cleaner branding component and features documentation
1 parent 93d3a49 commit b33abb4

File tree

6 files changed

+338
-288
lines changed

6 files changed

+338
-288
lines changed

src/routes/+page.server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { PageLoad } from "./$types";
2+
export const load: PageLoad = async () => {
3+
const r1 = fetch("https://api.github.com/repos/KTibow/m3-svelte");
4+
const r2 = fetch("https://discord.com/api/v10/invites/sRzVYM9b47?with_counts=true");
5+
const { stargazers_count } = await (await r1).json();
6+
const { approximate_member_count } = await (await r2).json();
7+
return { stars: stargazers_count as number, members: approximate_member_count as number };
8+
};

src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<title>M3 Svelte</title>
6565
<meta
6666
name="description"
67-
content="Implements the Material 3 design system in Svelte, cleanly, robustly, and across components, animations, and theming."
67+
content="The Material 3 design system in Svelte, cleanly, robustly, and across components, animations, and theming."
6868
/>
6969
</svelte:head>
7070

src/routes/Branding.svelte

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

src/routes/Hero.svelte

Lines changed: 110 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,122 @@
1-
<script>
2-
import iconSquoosh from "@ktibow/iconset-material-symbols/fullscreen-exit-rounded";
3-
import iconInject from "@ktibow/iconset-material-symbols/vaccines-outline-rounded";
4-
import Icon from "$lib/misc/Icon.svelte";
5-
import Branding from "./Branding.svelte";
1+
<script lang="ts">
2+
import { page } from "$app/state";
3+
import { resolve } from "$app/paths";
4+
5+
const name = "M3 Svelte";
6+
const description = "implements the Material 3 design system in Svelte.";
7+
const github = "https://github.com/KTibow/m3-svelte";
68
</script>
79

8-
<div class="wrapper">
9-
<Branding />
10-
<div class="pills">
11-
<div class="pill">
12-
<Icon icon={iconInject} />
13-
Now injecting globals
14-
</div>
15-
<div class="pill">
16-
<Icon icon={iconSquoosh} />
17-
Smallest CSS yet
18-
</div>
19-
</div>
10+
<div class="branding">
11+
<h1>
12+
<img src="https://ktibow.github.io/favicon.svg" alt="KTibow's" width="48" height="48" />
13+
{name}
14+
</h1>
15+
<p>{description}</p>
16+
<a href={github}>
17+
<p>GitHub</p>
18+
<p class="supporting">{page.data.stars} stars</p>
19+
</a>
20+
<a href="https://discord.gg/sRzVYM9b47">
21+
<p>Discord</p>
22+
<p class="supporting">{page.data.members} members</p>
23+
</a>
24+
<a href={resolve("/docs/features")}>
25+
<p>Features...</p>
26+
<p class="supporting">Powerful yet lean</p>
27+
</a>
2028
</div>
2129

2230
<style>
23-
.wrapper {
31+
.branding {
32+
--transition: var(--m3-timing-function-emphasized) 500ms;
2433
display: flex;
2534
flex-direction: column;
26-
align-items: center;
27-
gap: 1.5rem;
28-
padding: 6rem 0;
29-
}
30-
.pills {
31-
@apply --m3-label-large;
32-
display: flex;
3335
justify-content: center;
36+
border-radius: 1.5rem;
37+
background-color: var(--m3c-primary-container-subtle);
38+
color: var(--m3c-on-primary-container-subtle);
39+
transition: var(--transition);
40+
overflow: hidden;
3441
35-
gap: 0.5rem;
36-
flex-wrap: wrap;
37-
}
38-
.pill {
39-
background-color: var(--m3c-surface-container-low);
42+
margin-block: 6rem;
43+
margin-inline: auto;
4044
41-
height: 2rem;
42-
display: flex;
43-
align-items: center;
44-
gap: 0.5rem;
45-
padding: 0 1rem;
46-
border-radius: 2rem;
45+
/* COLLAPSED STATE */
46+
&:not(:hover, :has(a:focus-visible)) {
47+
> h1 {
48+
> img {
49+
width: 0;
50+
height: 0;
51+
opacity: 0;
52+
margin-right: 0;
53+
}
54+
}
55+
> p,
56+
> a {
57+
height: 0;
58+
margin: 0 -2rem;
59+
opacity: 0;
60+
padding-block: 0;
61+
pointer-events: none;
62+
}
63+
}
64+
65+
/* EXPANDED ELEMENTS */
66+
h1 {
67+
display: flex;
68+
align-items: center;
69+
justify-content: center;
70+
@apply --m3-display-large;
71+
font-weight: bold;
72+
margin-block: 0.5rem;
73+
margin-inline: 1rem;
74+
transition: var(--transition);
75+
76+
img {
77+
width: 1em;
78+
height: 1em;
79+
border-radius: var(--m3-shape-full);
80+
background-color: var(--m3c-surface);
81+
margin-right: 1rem;
82+
transition: var(--transition);
83+
}
84+
}
85+
86+
/* Description paragraph */
87+
& > p {
88+
height: 1.5rem;
89+
margin: 0;
90+
margin-inline: 1rem;
91+
overflow: hidden;
92+
white-space: nowrap;
93+
transition: var(--transition);
94+
}
95+
96+
/* Link "Buttons" */
97+
a {
98+
@apply --m3-focus-inward;
99+
display: flex;
100+
align-items: center;
101+
justify-content: space-between;
102+
height: 3rem;
103+
padding-inline: 1rem;
104+
border-radius: 1.5rem;
105+
margin-top: 0.5rem;
106+
background-color: var(--m3c-primary-container);
107+
color: var(--m3c-on-primary-container);
108+
text-decoration: none;
109+
transition: var(--transition);
110+
overflow: hidden;
111+
112+
p {
113+
margin: 0;
114+
}
115+
116+
.supporting {
117+
font-size: 0.85rem;
118+
opacity: 0.8;
119+
}
120+
}
47121
}
48122
</style>

0 commit comments

Comments
 (0)