Skip to content

Commit dcd80bf

Browse files
committed
Update docs site to mitigate scroll spill on small screen
1 parent 34b39ba commit dcd80bf

File tree

6 files changed

+129
-109
lines changed

6 files changed

+129
-109
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,4 @@ dist
173173

174174
# Finder (MacOS) folder config
175175
.DS_Store
176+
.vercel

packages/docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@astrojs/tailwind": "^5.1.1"
1919
},
2020
"scripts": {
21-
"dev": "astro dev",
21+
"dev": "astro dev --host",
2222
"start": "astro dev",
2323
"build": "astro check && astro build",
2424
"preview": "astro preview",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
import Layout from "./Layout.astro";
3+
4+
type Props = {
5+
title?: string;
6+
description?: string;
7+
};
8+
9+
const { title, description } = Astro.props;
10+
---
11+
12+
<Layout title={title} description={description}>
13+
<main
14+
class="lg:flex lg:items-start lg:gap-8 xl:gap-10 2xl:gap-12 w-full max-w-7xl"
15+
>
16+
<slot />
17+
</main>
18+
</Layout>

packages/docs/src/astro-components/Layout.astro

+7-4
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,14 @@ const pageTitle = [title, name].filter(Boolean).join(" — ");
153153
</div>
154154
</div>
155155
</header>
156-
<main
157-
class="lg:flex lg:items-start lg:gap-8 xl:gap-10 2xl:gap-12 w-full max-w-7xl"
156+
<slot />
157+
<footer
158+
class="w-full max-w-7xl border-t border-zinc-300 dark:border-zinc-700 pt-6"
158159
>
159-
<slot />
160-
</main>
160+
© {new Date().getFullYear()}
161+
<a href="httphttps://hyperlaunch.com/">Hyperlaunch</a>. All rights
162+
reserved.
163+
</footer>
161164
</body>
162165
</html>
163166
<script>

packages/docs/src/pages/[element].astro

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
import { getCollection } from "astro:content";
3+
import ComponentDocsLayout from "../astro-components/ComponentDocsLayout.astro";
34
import ComponentNav from "../astro-components/ComponentNav.astro";
45
import JumpLinks from "../astro-components/JumpLinks.astro";
5-
import Layout from "../astro-components/Layout.astro";
66
77
export const prerender = true;
88
@@ -19,7 +19,7 @@ const { name, tagline } = entry.data;
1919
const { Content } = await entry.render();
2020
---
2121

22-
<Layout>
22+
<ComponentDocsLayout>
2323
<div
2424
class="hidden lg:block sticky lg:top-4 xl:top-6 2xl:top-8 max-h-[100svh] overflow-auto flex-shrink w-64"
2525
>
@@ -93,7 +93,7 @@ const { Content } = await entry.render();
9393
</aside>
9494
</div>
9595
</div>
96-
</Layout>
96+
</ComponentDocsLayout>
9797
<script>
9898
import "@hyperkitxyz/elements/detail.ts";
9999
import "@hyperkitxyz/elements/transition.ts";

packages/docs/src/pages/index.astro

+99-101
Original file line numberDiff line numberDiff line change
@@ -8,114 +8,112 @@ const tree = await getComponentTree();
88
---
99

1010
<Layout>
11-
<div class="w-full flex flex-col gap-6 lg:gap-8 xl:gap-10 2xl:gap-12">
12-
<div class="flex flex-col w-full items-center justify-end relative">
13-
<Picture
14-
src={robot}
15-
format="webp"
16-
alt=""
17-
class="w-full max-w-4xl"
18-
widths={[375, 750, 1200, 1500]}
19-
/>
20-
<div class="lg:absolute z-40">
21-
<div
22-
class="max-w-5xl mx-auto text-black dark:text-white [text-shadow:_0_1px_30px_rgb(255_255_255/_100%)]
11+
<div class="flex flex-col items-center justify-end relative">
12+
<Picture
13+
src={robot}
14+
format="webp"
15+
alt=""
16+
class="w-full max-w-5xl"
17+
widths={[375, 750, 1200, 1500]}
18+
/>
19+
<div class="lg:absolute z-40">
20+
<div
21+
class="max-w-5xl mx-auto text-black dark:text-white [text-shadow:_0_1px_30px_rgb(255_255_255/_100%)]
2322
lg:[text-shadow:_0_1px_50px_rgb(255_255_255/_100%)] dark:[text-shadow:_0_1px_30px_rgb(0_0_0_/_100%)] dark:lg:[text-shadow:_0_1px_50px_rgb(0_0_0_/_100%)]"
23+
>
24+
<h1
25+
class="text-3xl sm:text-5xl md:text-6xl lg:text-7xl xl:text-8xl font-black mb-4 lg:mb-6 xl:mb-8"
2426
>
25-
<h1
26-
class="text-3xl sm:text-5xl md:text-6xl lg:text-7xl xl:text-8xl font-black mb-4 lg:mb-6 xl:mb-8"
27-
>
28-
Headless Elements, Supercharged UIs
29-
</h1>
30-
<p class="md:text-lg lg:text-xl xl:text-2xl">
31-
A suite of unstyled custom elements designed for building rich,
32-
interactive UIs rapidly &mdash; without writing JavaScript. From
33-
sortable lists to calendars, modals, and repeating forms, Hyperkit
34-
let's you create dynamic, scalable interfaces, with pure HTML &amp;
35-
CSS.
36-
</p>
37-
</div>
27+
Headless Elements, Supercharged UIs
28+
</h1>
29+
<p class="md:text-lg lg:text-xl xl:text-2xl">
30+
A suite of unstyled custom elements designed for building rich,
31+
interactive UIs rapidly &mdash; without writing JavaScript. From
32+
sortable lists to calendars, modals, and repeating forms, Hyperkit
33+
let's you create dynamic, scalable interfaces, with pure HTML &amp;
34+
CSS.
35+
</p>
3836
</div>
3937
</div>
40-
<div
41-
class="bg-zinc-950 dark:bg-white border border-zinc-700 dark:border-zinc-400 rounded shadow-md px-4 py-2 mr-auto lg:mx-auto white-space-no-wrap text-zinc-100 dark:text-zinc-950 text-sm lg:text-base font-medium"
42-
>
43-
bun add @hyperkitxyz/elements
44-
</div>
45-
<div class="flex items-center justify-center w-full">
46-
<div class="relative flex items-center w-full max-w-screen-lg">
47-
<div
48-
class="flex-grow h-px bg-gradient-to-r from-transparent via-zinc-200 to-zinc-200 dark:via-zinc-700 dark:to-zinc-700"
49-
>
50-
</div>
51-
<h2
52-
class="mx-4 text-xs uppercase font-semibold tracking-wider text-zinc-900 dark:text-zinc-100"
53-
>
54-
Components
55-
</h2>
56-
<div
57-
class="flex-grow h-px bg-gradient-to-l from-transparent via-zinc-200 to-zinc-200 dark:via-zinc-700 dark:to-zinc-700"
58-
>
59-
</div>
38+
</div>
39+
<div
40+
class="bg-zinc-950 dark:bg-white border border-zinc-700 dark:border-zinc-400 rounded shadow-md px-4 py-2 mr-auto lg:mx-auto white-space-no-wrap text-zinc-100 dark:text-zinc-950 text-sm lg:text-base font-medium"
41+
>
42+
bun add @hyperkitxyz/elements
43+
</div>
44+
<div class="flex items-center justify-center w-full max-w-3xl">
45+
<div class="relative flex items-center w-full max-w-screen-lg">
46+
<div
47+
class="flex-grow h-px bg-gradient-to-r from-transparent via-zinc-200 to-zinc-200 dark:via-zinc-700 dark:to-zinc-700"
48+
>
49+
</div>
50+
<h2
51+
class="mx-4 text-xs uppercase font-semibold tracking-wider text-lime-500 dark:text-lime-400"
52+
>
53+
Components
54+
</h2>
55+
<div
56+
class="flex-grow h-px bg-gradient-to-l from-transparent via-zinc-200 to-zinc-200 dark:via-zinc-700 dark:to-zinc-700"
57+
>
6058
</div>
6159
</div>
62-
<nav class="flex flex-col gap-2 lg:gap-4 xl:gap-6 2xl:gap-4">
63-
{
64-
tree.map(({ name, items }, i) => (
65-
<>
66-
<hyperkit-detail-summoner summons={`component-grid-${i}`}>
67-
<button class="block w-full flex items-center justify-between text-left px-4 py-2 lg:px-6 bg-zinc-200 dark:bg-zinc-800 rounded font-bold group">
68-
{name}
69-
<span class="group-data-[active]:rotate-180 transition-rotate duration-300">
70-
<svg
71-
xmlns="http://www.w3.org/2000/svg"
72-
fill="none"
73-
viewBox="0 0 24 24"
74-
stroke-width="1.5"
75-
stroke="currentColor"
76-
class="size-5"
77-
>
78-
<path
79-
stroke-linecap="round"
80-
stroke-linejoin="round"
81-
d="m4.5 15.75 7.5-7.5 7.5 7.5"
82-
/>
83-
</svg>
84-
</span>
85-
</button>
86-
</hyperkit-detail-summoner>
87-
<hyperkit-detail id={`component-grid-${i}`}>
88-
<hyperkit-transition
89-
class="grid gap-2 lg:gap-4 xl:gap-6 2xl:gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
90-
enter-class="transition-all duration-500 ease-in"
91-
enter-from-class="opacity-0 max-h-0"
92-
enter-to-class="opacity-100 max-h-[1000px]"
93-
exit-class="transition-all duration-300 ease-out"
94-
exit-from-class="opacity-100 max-h-[1000px]"
95-
exit-to-class="opacity-0 max-h-0"
96-
>
97-
{items.map((item) => (
98-
<a
99-
href={`/${item?.slug}`}
100-
class="group border border-zinc-200 dark:border-zinc-800 rounded overflow-hidden hover:bg-zinc-50 dark:hover:bg-zinc-900 transition-color duration-300"
101-
>
102-
<div class="p-4 lg:p-6 xl:p-8">
103-
<h3 class="lg:text-lg xl:text-xl font-semibold text-zinc-900 dark:text-zinc-100 group-hover:text-lime-500 dark:group-hover:text-lime-400 mb-2">
104-
{item?.data.name}
105-
</h3>
106-
<p class="text-zinc-600 dark:text-zinc-300 group-hover:text-zinc-900 dark:group-hover:text-zinc-100">
107-
{item?.data.tagline}
108-
</p>
109-
</div>
110-
</a>
111-
))}
112-
</hyperkit-transition>
113-
</hyperkit-detail>
114-
</>
115-
))
116-
}
117-
</nav>
11860
</div>
61+
<nav class="flex flex-col gap-2 lg:gap-4 xl:gap-6 2xl:gap-4 w-full max-w-7xl">
62+
{
63+
tree.map(({ name, items }, i) => (
64+
<>
65+
<hyperkit-detail-summoner summons={`component-grid-${i}`}>
66+
<button class="block w-full flex items-center justify-between text-left px-4 py-2 lg:px-6 bg-zinc-200 dark:bg-zinc-800 rounded font-bold group">
67+
{name}
68+
<span class="group-data-[active]:rotate-180 transition-rotate duration-300">
69+
<svg
70+
xmlns="http://www.w3.org/2000/svg"
71+
fill="none"
72+
viewBox="0 0 24 24"
73+
stroke-width="1.5"
74+
stroke="currentColor"
75+
class="size-5"
76+
>
77+
<path
78+
stroke-linecap="round"
79+
stroke-linejoin="round"
80+
d="m4.5 15.75 7.5-7.5 7.5 7.5"
81+
/>
82+
</svg>
83+
</span>
84+
</button>
85+
</hyperkit-detail-summoner>
86+
<hyperkit-detail id={`component-grid-${i}`}>
87+
<hyperkit-transition
88+
class="grid gap-2 lg:gap-4 xl:gap-6 2xl:gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
89+
enter-class="transition-all duration-500 ease-in"
90+
enter-from-class="opacity-0 max-h-0"
91+
enter-to-class="opacity-100 max-h-[1000px]"
92+
exit-class="transition-all duration-300 ease-out"
93+
exit-from-class="opacity-100 max-h-[1000px]"
94+
exit-to-class="opacity-0 max-h-0"
95+
>
96+
{items.map((item) => (
97+
<a
98+
href={`/${item?.slug}`}
99+
class="group border border-zinc-200 dark:border-zinc-800 rounded overflow-hidden hover:bg-zinc-50 dark:hover:bg-zinc-900 transition-color duration-300"
100+
>
101+
<div class="p-4 lg:p-6 xl:p-8">
102+
<h3 class="lg:text-lg xl:text-xl font-semibold text-zinc-900 dark:text-zinc-100 group-hover:text-lime-500 dark:group-hover:text-lime-400 mb-2">
103+
{item?.data.name}
104+
</h3>
105+
<p class="text-zinc-600 dark:text-zinc-300 group-hover:text-zinc-900 dark:group-hover:text-zinc-100">
106+
{item?.data.tagline}
107+
</p>
108+
</div>
109+
</a>
110+
))}
111+
</hyperkit-transition>
112+
</hyperkit-detail>
113+
</>
114+
))
115+
}
116+
</nav>
119117
</Layout>
120118
<script>
121119
import "@hyperkitxyz/elements/detail.ts";

0 commit comments

Comments
 (0)