Skip to content

Commit cc14203

Browse files
committed
Add Playground story to Box
1 parent bbbf5b1 commit cc14203

File tree

2 files changed

+69
-5
lines changed

2 files changed

+69
-5
lines changed

apps/docs/content/components/Box/react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Box
33
status: Experimental
44
a11yReviewed: false
55
source: https://github.com/primer/brand/blob/main/packages/react/src/Box/Box.tsx
6-
storybook: '/brand/storybook/?path=/story/components-box--default'
6+
storybook: '/brand/storybook/?path=/story/components-box--playground'
77
description: Use a box to simplify the process of applying one-off styles to an element
88
---
99

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,82 @@
11
import React from 'react'
22

33
import {Meta, StoryFn} from '@storybook/react'
4-
import {Box} from './Box'
4+
import {
5+
Box,
6+
BoxBackgroundColors,
7+
BoxBorderColorOptions,
8+
BoxBorderRadiusOptions,
9+
BoxBorderWidthOptions,
10+
BoxSpacingValues,
11+
} from './Box'
512
import {Text} from '../'
613

714
export default {
815
title: 'Components/Box',
916
component: Box,
1017
} as Meta<typeof Box>
1118

12-
const Template: StoryFn<typeof Box> = args => (
13-
<Box {...args}>
19+
export const Default = () => (
20+
<Box>
1421
<Text>Default Box</Text>
1522
</Box>
1623
)
1724

18-
export const Default = Template.bind({})
25+
export const Playground: StoryFn<typeof Box> = args => (
26+
<Box {...args}>
27+
<Text>Default Box</Text>
28+
</Box>
29+
)
30+
Playground.args = {
31+
padding: 'normal',
32+
margin: 'normal',
33+
backgroundColor: 'inset',
34+
borderRadius: 'medium',
35+
borderWidth: 'thin',
36+
borderColor: 'default',
37+
borderStyle: 'solid',
38+
}
39+
Playground.argTypes = {
40+
padding: {
41+
options: BoxSpacingValues,
42+
control: {
43+
type: 'select',
44+
},
45+
},
46+
margin: {
47+
options: BoxSpacingValues,
48+
control: {
49+
type: 'select',
50+
},
51+
},
52+
backgroundColor: {
53+
options: BoxBackgroundColors,
54+
control: {
55+
type: 'inline-radio',
56+
},
57+
},
58+
borderRadius: {
59+
options: BoxBorderRadiusOptions,
60+
control: {
61+
type: 'inline-radio',
62+
},
63+
},
64+
borderWidth: {
65+
options: BoxBorderWidthOptions,
66+
control: {
67+
type: 'inline-radio',
68+
},
69+
},
70+
borderColor: {
71+
options: BoxBorderColorOptions,
72+
control: {
73+
type: 'inline-radio',
74+
},
75+
},
76+
borderStyle: {
77+
options: ['none', 'solid'],
78+
control: {
79+
type: 'inline-radio',
80+
},
81+
},
82+
}

0 commit comments

Comments
 (0)