Skip to content

Commit 45ef9b3

Browse files
committed
Update storybook stories
1 parent 306d426 commit 45ef9b3

7 files changed

Lines changed: 300 additions & 179 deletions

File tree

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
},
1616
"devDependencies": {
1717
"@storybook/addon-essentials": "^8.6.0",
18-
"@storybook/addon-links": "^9.0.0",
19-
"@storybook/addon-themes": "^9.0.0",
18+
"@storybook/addon-links": "^8.6.0",
19+
"@storybook/addon-themes": "^8.6.0",
2020
"@storybook/blocks": "^8.6.0",
21-
"@storybook/react": "^9.0.0",
22-
"@storybook/react-vite": "^9.0.0",
21+
"@storybook/react": "^8.6.0",
22+
"@storybook/react-vite": "^8.6.0",
2323
"@storybook/test": "^8.6.0",
2424
"@types/prismjs": "^1.26.0",
2525
"@types/react": "^18.1.0",
@@ -32,7 +32,7 @@
3232
"prop-types": "15.8.0",
3333
"react": "^18.1.0",
3434
"react-dom": "^18.1.0",
35-
"storybook": "^9.0.0",
35+
"storybook": "^8.6.0",
3636
"svg2js": "^0.0.4-alpha1",
3737
"vite": "^6.3.0"
3838
},

stories/AppFooter.stories.ts

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

stories/AppFooter.stories.tsx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import React from 'react';
3+
import AppFooter from '../src/components/AppFooter';
4+
import Link from '../src/components/Link';
5+
import Logo from '../src/components/Logo';
6+
import Stack from '../src/components/Stack';
7+
8+
const meta: Meta<typeof AppFooter> = {
9+
component: AppFooter,
10+
render: args => <AppFooter {...args} className="border text-xs font-500" />,
11+
};
12+
13+
const links = [
14+
{
15+
href: '/?path=/story/appfooter--with-links#terms-of-service',
16+
name: 'Terms of Service',
17+
},
18+
{
19+
href: '/?path=/story/appfooter--with-links#privacy-policy',
20+
name: 'Privacy Policy',
21+
},
22+
{
23+
href: '/?path=/story/appfooter--with-links#contact',
24+
name: 'Contact',
25+
},
26+
];
27+
28+
export default meta;
29+
30+
type Story = StoryObj<typeof AppFooter>;
31+
32+
export const Basic: Story = {
33+
args: {
34+
left: (
35+
<Stack align="center">
36+
<Logo size="xs" />
37+
<span className="copyright mx-xl">
38+
Copyright <span aria-hidden>©</span> {new Date().getFullYear()} All
39+
Rights Reserved
40+
</span>
41+
</Stack>
42+
),
43+
},
44+
};
45+
46+
export const WithLinks: Story = {
47+
args: {
48+
left: (
49+
<Stack align="center">
50+
<Logo size="xs" />
51+
<span className="copyright mx-xl">
52+
Copyright <span aria-hidden>©</span> {new Date().getFullYear()} All
53+
Rights Reserved
54+
</span>
55+
</Stack>
56+
),
57+
right: (
58+
<Stack align="center" className="links" wrap>
59+
{links.map(link => (
60+
<Link className="text-inherit mx-sm" href={link.href} key={link.name}>
61+
{link.name}
62+
</Link>
63+
))}
64+
</Stack>
65+
),
66+
},
67+
};

stories/Input.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export const Text: Story = {
1515
args: {},
1616
};
1717

18+
export const Label: Story = {
19+
args: {
20+
label: 'Name',
21+
},
22+
};
23+
1824
export const Password: Story = {
1925
args: {
2026
placeholder: 'Password',
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import React, { useRef } from 'react';
3-
import PanAndZoomTransform from '../src/components/PanAndZoomTransform';
3+
import PanAndZoomProvider, { PanAndZoomTransform } from '../src/components/PanAndZoom'; // prettier-ignore
44
import ProgressiveImage from '../src/components/ProgressiveImage';
55

66
const meta: Meta<typeof PanAndZoomTransform> = {
@@ -15,16 +15,20 @@ export const Default: Story = {
1515
render: args => {
1616
const ref = useRef<HTMLDivElement>(null);
1717
return (
18-
<div ref={ref} style={{ width: 960, height: 540 }}>
19-
<PanAndZoomTransform {...args} container={ref}>
20-
{panning => (
18+
<PanAndZoomProvider
19+
{...args}
20+
ref={ref}
21+
style={{ width: 960, height: 540 }}
22+
>
23+
{(state, panning, resetMap) => (
24+
<PanAndZoomTransform>
2125
<ProgressiveImage
22-
imageClassName="pointer-events-none select-none"
26+
imageClassName="pointer-none select-none"
2327
src="https://picsum.photos/960/540"
2428
/>
25-
)}
26-
</PanAndZoomTransform>
27-
</div>
29+
</PanAndZoomTransform>
30+
)}
31+
</PanAndZoomProvider>
2832
);
2933
},
3034
};

stories/Tooltip.stories.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import React, { useRef, useState } from 'react';
3+
import Button from '../src/components/Button';
4+
import Tooltip from '../src/components/Tooltip';
5+
6+
const meta: Meta<typeof Tooltip> = {
7+
component: Tooltip,
8+
render: args => {
9+
return (
10+
<div className="flex justify-center align-center w-2xxl h-2xxl">
11+
<Tooltip {...args} />
12+
</div>
13+
);
14+
},
15+
};
16+
17+
export default meta;
18+
19+
type Story = StoryObj<typeof Tooltip>;
20+
21+
export const ArrowDown: Story = {
22+
args: {
23+
arrow: 'down',
24+
children: 'Tooltip',
25+
},
26+
};
27+
28+
export const ArrowUp: Story = {
29+
args: {
30+
arrow: 'up',
31+
children: 'Tooltip',
32+
},
33+
};
34+
35+
export const ArrowRight: Story = {
36+
args: {
37+
arrow: 'right',
38+
children: 'Tooltip',
39+
},
40+
};
41+
42+
export const ArrowLeft: Story = {
43+
args: {
44+
arrow: 'left',
45+
children: 'Tooltip',
46+
},
47+
};
48+
49+
export const InfoTooltip: Story = {
50+
args: {
51+
children: 'Tooltip',
52+
},
53+
render: args => {
54+
const ref = useRef<HTMLDivElement>(null);
55+
const [hovering, setHovering] = useState(false);
56+
return (
57+
<div ref={ref} style={{ width: '42px', height: '42px' }}>
58+
<Button
59+
icon="info_outline"
60+
iconAlignment="only"
61+
onMouseEnter={e => setHovering(true)}
62+
onMouseLeave={e => setHovering(false)}
63+
size="lg"
64+
shape="circle"
65+
variant="unstyled"
66+
/>
67+
{hovering && <Tooltip {...args} element={ref.current} />}
68+
</div>
69+
);
70+
},
71+
};

0 commit comments

Comments
 (0)