Skip to content

Commit c25342a

Browse files
committed
feat: initial docs design
1 parent 1aa42c7 commit c25342a

File tree

7 files changed

+198
-82
lines changed

7 files changed

+198
-82
lines changed

website/app/components/header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const Header = () => {
4545
rel="noopener noreferrer"
4646
className={buttonVariants({ variant: 'ghost', size: 'icon' })}
4747
>
48-
<link.icon height={20} width={20} />
48+
<link.icon height={18} width={18} />
4949
<span className="sr-only">{link.label}</span>
5050
</a>
5151
))}

website/app/components/hero.tsx

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Button } from '@/ui/button';
2+
import { SparkleCard } from '@/ui/sparkle-card';
3+
import { useToast } from '@pheralb/toast';
4+
import { Sparkles } from 'lucide-react';
5+
import { Github } from './icons';
6+
7+
const Hero = () => {
8+
const toast = useToast();
9+
return (
10+
<SparkleCard className="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900">
11+
<div className="mb-4 flex flex-col space-y-1">
12+
<h1 className="text-5xl font-bold tracking-tight lg:text-4xl">Toast</h1>
13+
<p className="font-medium text-neutral-500 dark:text-neutral-400">
14+
An accessible and beautiful toast library for React.
15+
</p>
16+
</div>
17+
<div className="flex items-center space-x-2">
18+
<Button
19+
variant="default"
20+
onClick={() =>
21+
toast.open({
22+
text: 'pheralb/toast',
23+
variant: 'success',
24+
description: '✨ A beautiful toast library for React',
25+
})
26+
}
27+
>
28+
<Sparkles size={14} />
29+
<span>Render a toast</span>
30+
</Button>
31+
<Button
32+
variant="outline"
33+
onClick={() =>
34+
toast.open({
35+
text: 'Hello, world!',
36+
description: 'This is a description',
37+
variant: 'info',
38+
action() {
39+
console.log('Action clicked');
40+
},
41+
})
42+
}
43+
>
44+
<Github height={14} />
45+
<span>View on GitHub</span>
46+
</Button>
47+
</div>
48+
</SparkleCard>
49+
);
50+
};
51+
52+
export default Hero;

website/app/components/icons.tsx

+97-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,100 @@ const X = (props: SVGProps<SVGSVGElement>) => (
7474
);
7575
export default X;
7676

77-
export { Logo, Github };
77+
const Nextjs = (props: SVGProps<SVGSVGElement>) => (
78+
<svg
79+
viewBox="0 0 180 180"
80+
fill="none"
81+
xmlns="http://www.w3.org/2000/svg"
82+
{...props}
83+
>
84+
<mask
85+
id="mask0_408_139"
86+
style={{
87+
maskType: 'alpha',
88+
}}
89+
maskUnits="userSpaceOnUse"
90+
x={0}
91+
y={0}
92+
width={180}
93+
height={180}
94+
>
95+
<circle cx={90} cy={90} r={90} fill="black" />
96+
</mask>
97+
<g mask="url(#mask0_408_139)">
98+
<circle
99+
cx={90}
100+
cy={90}
101+
r={87}
102+
fill="black"
103+
stroke="white"
104+
strokeWidth={6}
105+
/>
106+
<path
107+
d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z"
108+
fill="url(#paint0_linear_408_139)"
109+
/>
110+
<rect
111+
x={115}
112+
y={54}
113+
width={12}
114+
height={72}
115+
fill="url(#paint1_linear_408_139)"
116+
/>
117+
</g>
118+
<defs>
119+
<linearGradient
120+
id="paint0_linear_408_139"
121+
x1={109}
122+
y1={116.5}
123+
x2={144.5}
124+
y2={160.5}
125+
gradientUnits="userSpaceOnUse"
126+
>
127+
<stop stopColor="white" />
128+
<stop offset={1} stopColor="white" stopOpacity={0} />
129+
</linearGradient>
130+
<linearGradient
131+
id="paint1_linear_408_139"
132+
x1={121}
133+
y1={54}
134+
x2={120.799}
135+
y2={106.875}
136+
gradientUnits="userSpaceOnUse"
137+
>
138+
<stop stopColor="white" />
139+
<stop offset={1} stopColor="white" stopOpacity={0} />
140+
</linearGradient>
141+
</defs>
142+
</svg>
143+
);
144+
145+
const Remix = (props: SVGProps<SVGSVGElement>) => (
146+
<svg viewBox="0 0 256 297" xmlns="http://www.w3.org/2000/svg" {...props}>
147+
<path
148+
d="M141.675 0C218.047 0 256 36.35 256 94.414c0 43.43-26.707 71.753-62.785 76.474 30.455 6.137 48.259 23.604 51.54 58.065l.474 6.337.415 5.924.358 5.542.249 4.179.267 4.93.138 2.814.198 4.47.159 4.222.079 2.427.107 3.888.092 4.446.033 2.148.06 6.226.02 6.496v3.885h-78.758l.004-1.62.028-3.147.047-3.065.136-7.424.035-2.489.027-3.902-.004-2.496-.023-2.617-.032-2.054-.064-2.876-.094-3.05-.125-3.242-.16-3.455-.096-1.813-.16-2.833-.186-2.976-.287-4.204-.247-3.342a116.56 116.56 0 0 0-.247-3.02l-.202-1.934c-2.6-22.827-11.655-32.157-27.163-35.269l-1.307-.245a60.184 60.184 0 0 0-2.704-.408l-1.397-.164c-.236-.025-.472-.05-.71-.073l-1.442-.127-1.471-.103-1.502-.081-1.514-.058-1.544-.039-1.574-.018L0 198.74V136.9h127.62c2.086 0 4.108-.04 6.066-.12l1.936-.095 1.893-.122 1.85-.15c.305-.028.608-.056.909-.086l1.785-.193a86.3 86.3 0 0 0 3.442-.475l1.657-.28c20.709-3.755 31.063-14.749 31.063-36.2 0-24.075-16.867-38.666-50.602-38.666H0V0h141.675ZM83.276 250.785c10.333 0 14.657 5.738 16.197 11.23l.203.79.167.782.109.617.046.306.078.603.058.59.023.29.031.569.01.278.008.54v29.507H0v-46.102h83.276Z"
149+
fill="currentColor"
150+
fillRule="nonzero"
151+
/>
152+
</svg>
153+
);
154+
155+
const Astro = (props: SVGProps<SVGSVGElement>) => (
156+
<svg
157+
viewBox="0 0 256 366"
158+
xmlns="http://www.w3.org/2000/svg"
159+
preserveAspectRatio="xMidYMid"
160+
{...props}
161+
>
162+
<path
163+
fill="currentColor"
164+
d="M182.022 9.147c2.982 3.702 4.502 8.697 7.543 18.687L256 246.074a276.467 276.467 0 0 0-79.426-26.891L133.318 73.008a5.63 5.63 0 0 0-10.802.017L79.784 219.11A276.453 276.453 0 0 0 0 246.04L66.76 27.783c3.051-9.972 4.577-14.959 7.559-18.654a24.541 24.541 0 0 1 9.946-7.358C88.67 0 93.885 0 104.314 0h47.683c10.443 0 15.664 0 20.074 1.774a24.545 24.545 0 0 1 9.95 7.373Z"
165+
/>
166+
<path
167+
fill="#FF5D01"
168+
d="M189.972 256.46c-10.952 9.364-32.812 15.751-57.992 15.751-30.904 0-56.807-9.621-63.68-22.56-2.458 7.415-3.009 15.903-3.009 21.324 0 0-1.619 26.623 16.898 45.14 0-9.615 7.795-17.41 17.41-17.41 16.48 0 16.46 14.378 16.446 26.043l-.001 1.041c0 17.705 10.82 32.883 26.21 39.28a35.685 35.685 0 0 1-3.588-15.647c0-16.886 9.913-23.173 21.435-30.48 9.167-5.814 19.353-12.274 26.372-25.232a47.588 47.588 0 0 0 5.742-22.735c0-5.06-.786-9.938-2.243-14.516Z"
169+
/>
170+
</svg>
171+
);
172+
173+
export { Logo, Github, Nextjs, Remix, Astro };

website/app/components/usage.tsx

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Link } from '@remix-run/react';
2+
import { Astro, Nextjs, Remix } from './icons';
3+
4+
const usageLinks = [
5+
{
6+
label: 'Next.js',
7+
to: '/docs/nextjs',
8+
icon: Nextjs,
9+
},
10+
{
11+
label: 'Remix',
12+
to: '/docs/remix',
13+
icon: Remix,
14+
},
15+
{
16+
label: 'Astro',
17+
to: '/docs/astro',
18+
icon: Astro,
19+
},
20+
];
21+
22+
const Usage = () => {
23+
return (
24+
<div className="flex items-center space-x-2">
25+
{usageLinks.map((link) => {
26+
return (
27+
<Link
28+
key={link.to}
29+
to={link.to}
30+
className="text-md flex flex-col items-center space-y-3 rounded-md border border-neutral-200 p-[20px] text-sm no-underline shadow-sm transition-colors duration-100 hover:bg-neutral-100 dark:border-neutral-800 dark:hover:bg-neutral-800/50"
31+
>
32+
<link.icon height={35} />
33+
<span>Install on {link.label}</span>
34+
</Link>
35+
);
36+
})}
37+
</div>
38+
);
39+
};
40+
41+
export default Usage;

website/app/root.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { cn } from './utils';
1616
// Layout:
1717
import Header from './components/header';
1818
import SidebarContent from './components/sidebar';
19+
import { proseClasses } from './ui/prose';
1920

2021
// Providers:
2122
import { ToastProvider } from '@pheralb/toast';
@@ -66,15 +67,14 @@ function App() {
6667
)}
6768
>
6869
<Header />
69-
<ToastProvider
70-
position="bottom-right"
71-
theme={data.theme == 'dark' ? 'dark' : 'light'}
72-
>
70+
<ToastProvider position="bottom-right" theme={theme!}>
7371
<div className="container mx-auto max-w-7xl">
7472
<SidebarContent />
75-
<main className="ml-60">
73+
<article
74+
className={cn('ml-60 w-full max-w-4xl py-8', proseClasses)}
75+
>
7676
<Outlet />
77-
</main>
77+
</article>
7878
</div>
7979
</ToastProvider>
8080
<ScrollRestoration />

website/app/routes/_index.tsx

-59
This file was deleted.

website/app/routes/docs.tsx

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
import { cn } from '@/utils';
21
import { Outlet } from '@remix-run/react';
32

43
export default function DocsLayout() {
5-
return (
6-
<article
7-
className={cn(
8-
'w-full max-w-3xl py-8',
9-
'prose prose-neutral dark:prose-invert',
10-
'prose-headings:font-medium prose-headings:tracking-tight',
11-
'prose-a:underline-offset-[4px] prose-a:decoration-solid dark:prose-a:decoration-neutral-500 prose-a:decoration-neutral-400',
12-
'prose-figure:my-0 prose-p:mb-1 prose-p:text-pretty',
13-
'prose-pre:border dark:prose-pre:border-neutral-800 prose-pre:border-neutral-200',
14-
)}
15-
>
16-
<Outlet />
17-
</article>
18-
);
4+
return <Outlet />;
195
}

0 commit comments

Comments
 (0)