Skip to content

Commit 51816ec

Browse files
author
Adam Plesnik
committed
Add demo page for experiments
1 parent e272af6 commit 51816ec

File tree

14 files changed

+232
-9
lines changed

14 files changed

+232
-9
lines changed

docs/src/components/Code.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { PropsWithChildren } from 'react'
2+
3+
const Code = ({ children }: PropsWithChildren<InlineCodeProps>) => (
4+
<pre className="font-mono whitespace-nowrap bg-fuchsia-200/40 p-1 px-1 py-0.5 text-sm dark:bg-indigo-200/20 dark:text-zinc-200 inline-block">
5+
{children}
6+
</pre>
7+
)
8+
9+
export interface InlineCodeProps {
10+
children: PropsWithChildren
11+
}
12+
13+
export default Code
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { addWithSpace } from '../utils/addWithSpace'
2+
import Code from './Code'
3+
4+
const DemoAnimationExampleRow = ({
5+
animations,
6+
bgColor,
7+
timeline,
8+
}: DemoAnimationExampleRowProps) => {
9+
const animationClasses = animations.split(' ')
10+
return (
11+
<div className="flex flex-col">
12+
<div className="flex flex-wrap gap-1 w-96 flex-shrink-0">
13+
{animationClasses.map((animation) => (
14+
<Code key={animation}>.{animation}</Code>
15+
))}
16+
</div>
17+
<div
18+
className={
19+
'animate-width w-0 h-4' +
20+
addWithSpace(animations) +
21+
addWithSpace(bgColor) +
22+
addWithSpace(timeline)
23+
}
24+
></div>
25+
</div>
26+
)
27+
}
28+
29+
export interface DemoAnimationExampleRowProps {
30+
animations: string
31+
bgColor: string
32+
timeline: string
33+
}
34+
35+
export default DemoAnimationExampleRow
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { PropsWithChildren } from 'react'
2+
import { addWithSpace } from '../utils/addWithSpace'
3+
4+
const DemoPlaceholderContent = ({
5+
children,
6+
className = '',
7+
}: PropsWithChildren<DemoWrapperProps>) => {
8+
return (
9+
<div
10+
className={
11+
'm-4 rounded-lg border border-dashed border-fuchsia-300 p-8 dark:border-cyan-900' +
12+
addWithSpace(className)
13+
}
14+
>
15+
{children}
16+
</div>
17+
)
18+
}
19+
20+
export interface DemoWrapperProps {
21+
children: PropsWithChildren
22+
className?: string
23+
}
24+
25+
export default DemoPlaceholderContent
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { PropsWithChildren } from 'react'
2+
3+
const DemoWrapper = ({ children }: PropsWithChildren<DemoWrapperProps>) => {
4+
return (
5+
<div className="relative mb-4 h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-zinc-300 bg-zinc-100/70 dark:border-zinc-700 dark:bg-black/10">
6+
{children}
7+
</div>
8+
)
9+
}
10+
11+
export interface DemoWrapperProps {
12+
children: PropsWithChildren
13+
}
14+
15+
export default DemoWrapper

docs/src/components/Paragraph.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { PropsWithChildren } from 'react'
2+
3+
const Paragraph = ({
4+
children,
5+
className = '',
6+
size = 'regular',
7+
}: PropsWithChildren<ParagraphProps>) => {
8+
return (
9+
<p
10+
className={
11+
'mb-5 w-full ' +
12+
(size === 'regular'
13+
? 'text-base leading-7'
14+
: size === 'large'
15+
? 'text-lg'
16+
: 'text-sm font-medium') +
17+
(className && ` ${className}`)
18+
}
19+
>
20+
{children}
21+
</p>
22+
)
23+
}
24+
25+
export interface ParagraphProps {
26+
children: PropsWithChildren
27+
className?: string
28+
size?: 'regular' | 'large' | 'small'
29+
}
30+
31+
export default Paragraph

docs/src/components/Separator.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const Separator = () => <div className="h-px w-full bg-current opacity-10 dark:opacity-20"></div>
2+
3+
export default Separator

docs/src/components/Skeleton.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Skeleton = ({ width = '200px' }) => {
2+
return (
3+
<div style={{ width: width }} className="mb-2 h-6 rounded-full bg-gray-200 dark:bg-slate-700" />
4+
)
5+
}
6+
export default Skeleton

docs/src/css/keyframes.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@keyframes appear {
2+
to {
3+
width: auto;
4+
}
5+
}
6+
7+
@keyframes slide-from-left {
8+
to {
9+
transform: translateX(0);
10+
}
11+
}
12+
13+
@keyframes width {
14+
to {
15+
width: 100%;
16+
}
17+
}

docs/src/index.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1+
@import 'css/keyframes.css';
12
@import 'css/prism.css';
23

34
@tailwind base;
45
@tailwind components;
56
@tailwind utilities;
6-
7-
@keyframes appear {
8-
to {
9-
width: auto;
10-
}
11-
}

docs/src/main.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@ import ReactDOM from 'react-dom/client'
33
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
44
import Home from './pages/Home.tsx'
55
import './index.css'
6+
import RangeDemo from './pages/RangeDemo.tsx'
67

78
const router = createBrowserRouter([
89
{
910
path: '/',
1011
element: <Home />,
1112
errorElement: <Home />,
1213
},
14+
{
15+
path: '/demo',
16+
children: [
17+
{
18+
path: 'range',
19+
element: <RangeDemo />,
20+
},
21+
],
22+
},
1323
])
1424

1525
ReactDOM.createRoot(document.getElementById('root')!).render(

0 commit comments

Comments
 (0)