Skip to content

Commit 48e6307

Browse files
committed
add story for Json
1 parent ec53687 commit 48e6307

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { Meta, StoryObj } from '@storybook/react'
2+
import type { ComponentProps } from 'react'
3+
import Json from './Json.js'
4+
5+
const meta: Meta<typeof Json> = {
6+
component: Json,
7+
}
8+
export default meta
9+
type Story = StoryObj<typeof Json>;
10+
11+
function render(args: ComponentProps<typeof Json>) {
12+
return (
13+
<div style={{ padding: '2rem', backgroundColor: '#22222b' }}>
14+
<Json {...args} />
15+
</div>
16+
)
17+
}
18+
19+
export const Default: Story = {
20+
args: {
21+
json: {
22+
a: 1,
23+
b: 'hello',
24+
c: [1, 2, 3],
25+
d: { e: 4, f: 5 },
26+
},
27+
label: 'json',
28+
},
29+
render,
30+
}
31+
32+
export const Arrays: Story = {
33+
args: {
34+
json: {
35+
a: Array.from({ length: 100 }, (_, i) => i),
36+
b: Array.from({ length: 100 }, (_, i) => `hello ${i}`),
37+
c: Array.from({ length: 100 }, (_, i) => [i, i + 1, i + 2]),
38+
},
39+
label: 'json',
40+
},
41+
render,
42+
}

0 commit comments

Comments
 (0)