Skip to content

Commit ec9badc

Browse files
committed
Inset header and many design fixes
1 parent 166100e commit ec9badc

File tree

16 files changed

+198
-190
lines changed

16 files changed

+198
-190
lines changed

packages/docs/src/components/Footer.tsx

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import * as React from 'react';
99
import * as stylex from '@stylexjs/stylex';
10+
import { GithubIcon, TwitterIcon } from 'lucide-react';
1011

1112
function ExternalLinkIcon(props: React.SVGProps<SVGSVGElement>) {
1213
return (
@@ -27,59 +28,6 @@ function ExternalLinkIcon(props: React.SVGProps<SVGSVGElement>) {
2728
);
2829
}
2930

30-
function GithubIcon(props: React.SVGProps<SVGSVGElement>) {
31-
return (
32-
<svg
33-
xmlns="http://www.w3.org/2000/svg"
34-
viewBox="0 0 24 24"
35-
fill="none"
36-
stroke="currentColor"
37-
strokeWidth="2"
38-
strokeLinecap="round"
39-
strokeLinejoin="round"
40-
{...props}
41-
>
42-
<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4" />
43-
<path d="M9 18c-4.51 2-5-2-7-2" />
44-
</svg>
45-
);
46-
}
47-
48-
function TwitterIcon(props: React.SVGProps<SVGSVGElement>) {
49-
return (
50-
<svg
51-
xmlns="http://www.w3.org/2000/svg"
52-
viewBox="0 0 24 24"
53-
fill="none"
54-
stroke="currentColor"
55-
strokeWidth="2"
56-
strokeLinecap="round"
57-
strokeLinejoin="round"
58-
{...props}
59-
>
60-
<path d="M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z" />
61-
</svg>
62-
);
63-
}
64-
65-
function BlueskyIcon(props: React.SVGProps<SVGSVGElement>) {
66-
return (
67-
<svg
68-
xmlns="http://www.w3.org/2000/svg"
69-
viewBox="0 0 24 24"
70-
fill="none"
71-
stroke="currentColor"
72-
strokeWidth="2"
73-
strokeLinecap="round"
74-
strokeLinejoin="round"
75-
{...props}
76-
>
77-
<path d="M12 11c-2-4-5-7-7-7-1.5 0-2.5 1-2.5 2.5C2.5 8 3 11 4 12.5c1 1.5 3 2 5 1.5-.5 2-1 4.5 1 6s4-1 5-3c1 2 3 4.5 5 3s1.5-4 1-6c2 .5 4 0 5-1.5 1-1.5 1.5-4.5 1.5-6 0-1.5-1-2.5-2.5-2.5-2 0-5 3-7 7z" />
78-
<path d="M12 18.5v3" />
79-
</svg>
80-
);
81-
}
82-
8331
const footerLinks = {
8432
develop: [
8533
{ label: 'Learn', href: '/docs/learn' },
@@ -219,14 +167,14 @@ export default function Footer() {
219167
>
220168
<TwitterIcon {...stylex.props(styles.socialIcon)} />
221169
</a>
222-
<a
170+
{/* <a
223171
href="https://bsky.app/profile/stylex.dev"
224172
target="_blank"
225173
rel="noopener noreferrer"
226174
{...stylex.props(styles.socialLink)}
227175
>
228176
<BlueskyIcon {...stylex.props(styles.socialIcon)} />
229-
</a>
177+
</a> */}
230178
</div>
231179
</div>
232180
</div>
@@ -268,13 +216,15 @@ const styles = stylex.create({
268216
fontWeight: 600,
269217
fontSize: '0.875rem',
270218
color: 'var(--color-fd-foreground)',
219+
textAlign: 'center',
271220
},
272221
list: {
273222
listStyle: 'none',
274223
margin: 0,
275224
padding: 0,
276225
display: 'flex',
277226
flexDirection: 'column',
227+
alignItems: 'center',
278228
gap: 8,
279229
},
280230
link: {

packages/docs/src/components/LogoBold.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ export default function LogoBold({ xstyle }: { xstyle?: stylex.StyleXStyles }) {
3939
</defs>
4040
<path
4141
d="M298.101 227.366c2.391 5.6 13.07 27.839 15.264 33.295-13.355 22.14-16.488 27.885-44.407 62.98C155.339 441.287 67.678 460.298 13.96 405.337 8.712 399.73 4.058 392.44 0 383.467c1.143 2.058 2.653 4.326 4.53 6.804l.679.883c.115.149.232.298.35.448l.724.91.754.926.785.944.815.961.846.979.876.996.906 1.013.938 1.031.48.522.983 1.057.503.535 1.028 1.083.526.548c66.356 60.072 132.546 8.534 222.416-91.044 13.566-15.775 33.553-44.007 59.962-84.697Zm34.703-190.061c42.053 36.145 42.053 92.233 10.507 172.34-2.417-5.89-13.066-29.436-15.736-35.468 24.834-68.036 25.41-100.38-10.306-132.635-20.547-18.555-35.138-19.319-62.918-14.8l-1.819.303c-.304.051-.609.104-.914.157l-1.84.328-1.854.342-.933.177-21.905 4.338v-.04l.483-.176c43.96-16.015 81.711-17.295 107.235 5.134Z"
42-
fill={`url(#${id}-a)`}
42+
fill={`#5BD3F3`}
4343
transform="translate(278 -.052)"
4444
/>
4545
<path
4646
d="M305.062 153.35c66.669 125.717 70.877 193.743 48.67 241.331-8 17.148-27.95 28.999-36.532 33.608-21.54 11.568-66.138 5.808-106.006-5.873l-5.976-2.544c20.033 6.443 63.57 14.86 87.042 8.417 77.085-21.16 67.914-112.798-9.564-256.715C205.218 27.657 120.448-11.821 53.627 15.314c-6.416 2.605-12.01 6.165-16.822 10.575l.515-.549 1.033-1.084.517-.534 1.038-1.054c7.453-7.476 15.18-13.311 23.143-15.997 60.427-20.382 164.163-.12 242.011 146.679Z"
47-
fill={`url(#${id}-b)`}
47+
fill={`#D573DE`}
4848
transform="translate(278 -.052)"
4949
/>
5050
<path

packages/docs/src/components/TypingWord.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
'use client';
99

10-
import * as React from 'react';
1110
import * as stylex from '@stylexjs/stylex';
11+
import { useEffect, useState } from 'react';
1212

1313
const words = [
1414
'expressive',
@@ -19,11 +19,11 @@ const words = [
1919
];
2020

2121
export default function TypingWord() {
22-
const [index, setIndex] = React.useState(0);
23-
const [displayed, setDisplayed] = React.useState('');
24-
const [isDeleting, setIsDeleting] = React.useState(false);
22+
const [index, setIndex] = useState(0);
23+
const [displayed, setDisplayed] = useState('');
24+
const [isDeleting, setIsDeleting] = useState(false);
2525

26-
React.useEffect(() => {
26+
useEffect(() => {
2727
const word = words[index] ?? '';
2828

2929
if (!isDeleting && displayed === word) {
@@ -58,7 +58,7 @@ export default function TypingWord() {
5858

5959
const styles = stylex.create({
6060
typingWord: {
61+
color: 'var(--color-fd-primary)',
6162
fontWeight: 700,
6263
},
6364
});
64-

packages/docs/src/components/layout/docs.tsx

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ export function DocsLayout({ tree, children, ...props }: DocsLayoutProps) {
3939
<div {...stylex.props(layoutStyles.wrapper)}>
4040
<main id="nd-docs-layout" {...stylex.props(layoutStyles.main)}>
4141
<Sidebar />
42-
<div {...stylex.props(layoutStyles.content)}>
43-
{children}
44-
</div>
42+
<div {...stylex.props(layoutStyles.content)}>{children}</div>
43+
<Footer />
4544
</main>
46-
<Footer />
4745
</div>
4846
</TreeContextProvider>
4947
);
@@ -85,22 +83,27 @@ const layoutStyles = stylex.create({
8583
main: {
8684
// flex flex-1 flex-row [--fd-nav-height:56px]
8785
display: 'flex',
86+
flexDirection: 'column',
8887
flexGrow: 1,
89-
flexDirection: 'row',
90-
['--fd-nav-height' as any]: '56px',
88+
// flexDirection: 'row',
89+
['--fd-nav-height' as any]: '64px',
90+
paddingInlineStart: {
91+
default: 292,
92+
'@media (max-width: 767.9px)': 0,
93+
},
9194
},
9295
content: {
93-
display: 'flex',
94-
flexDirection: 'column',
95-
flexGrow: 1,
96-
minWidth: 0,
96+
// flexGrow: 1,
97+
// minWidth: 0,
9798
},
9899
});
99100

100101
function Sidebar() {
101102
const { root } = useTreeContext();
102103
const [open] = use(SidebarContext);
103104

105+
console.log('open', open);
106+
104107
const children = useMemo(() => {
105108
function renderItems(items: PageTree.Node[]) {
106109
return items.map((item) => (
@@ -123,6 +126,10 @@ function Sidebar() {
123126
open === false && sidebarStyles.closed,
124127
)}
125128
>
129+
<div {...stylex.props(sidebarStyles.blurContainer)}>
130+
<div {...stylex.props(sidebarStyles.blur)} />
131+
</div>
132+
126133
<aside {...stylex.props(sidebarStyles.base)} ref={sidebarRef}>
127134
{children}
128135
</aside>
@@ -131,37 +138,64 @@ function Sidebar() {
131138
}
132139
const sidebarStyles = stylex.create({
133140
container: {
134-
position: 'sticky',
135-
top: 56,
141+
position: 'fixed',
142+
top: 64,
143+
left: 0,
136144
display: {
137145
default: 'flex',
138146
'@media (max-width: 767.9px)': 'none',
139147
},
140148
alignSelf: 'flex-start',
141149
flexShrink: 0,
142150
padding: 8,
143-
height: 'calc(100dvh - 56px)',
151+
height: 'calc(100dvh - 64px)',
152+
transform: {
153+
default: 'translateX(0px)',
154+
'@media (max-width: 767.9px)': 'translateX(-100%)',
155+
},
156+
transitionProperty: 'transform',
157+
transitionDuration: '0.15s',
158+
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
144159
zIndex: 10,
145160
},
161+
open: {
162+
transform: 'translateX(0)',
163+
},
164+
closed: {
165+
transform: 'translateX(-100%)',
166+
},
167+
blurContainer: {
168+
position: 'absolute',
169+
inset: 8,
170+
overflow: 'hidden',
171+
borderRadius: 20,
172+
cornerShape: 'squircle',
173+
zIndex: 1,
174+
},
175+
blur: {
176+
position: 'absolute',
177+
inset: -64,
178+
insetInlineStart: -8,
179+
backdropFilter: 'blur(32px) saturate(800%)',
180+
},
146181
base: {
147182
display: 'flex',
148183
flexDirection: 'column',
149184
gap: 2,
150185
padding: 4 * 4,
151-
fontSize: `${14 / 16}rem`,
186+
fontSize: `1rem`,
152187
overflowY: 'auto',
153188
overscrollBehavior: 'contain',
154189
width: 280,
155190
height: '100%',
156-
backgroundColor: 'var(--color-fd-background)',
157191
borderRadius: 20,
192+
cornerShape: 'squircle',
158193
borderWidth: 1,
159194
borderStyle: 'solid',
160195
borderColor: 'var(--color-fd-border)',
161196
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.06)',
197+
zIndex: 10,
162198
},
163-
open: {},
164-
closed: {},
165199
});
166200

167201
function SidebarItem({
@@ -333,7 +367,7 @@ const linkVariants = stylex.create({
333367
position: 'relative',
334368
display: 'inline-flex',
335369
alignItems: 'center',
336-
fontSize: `${14 / 16}rem`,
370+
fontSize: `1rem`,
337371
lineHeight: 1.42,
338372
gap: 2 * 4,
339373
paddingBlock: 1.5 * 4,

packages/docs/src/components/layout/home/SidebarToggle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { SidebarIcon } from 'lucide-react';
55
import { use } from 'react';
66

77
export default function SidebarToggle() {
8-
const [open, setOpen] = use(SidebarContext);
8+
const [_open, setOpen] = use(SidebarContext);
9+
910
return (
1011
<button
1112
type="button"

0 commit comments

Comments
 (0)