diff --git a/apps/docs/content/components/Box/react.mdx b/apps/docs/content/components/Box/react.mdx index b2ced7a26..7fd284414 100644 --- a/apps/docs/content/components/Box/react.mdx +++ b/apps/docs/content/components/Box/react.mdx @@ -3,7 +3,7 @@ title: Box status: Experimental a11yReviewed: false source: https://github.com/primer/brand/blob/main/packages/react/src/Box/Box.tsx -storybook: '/brand/storybook/?path=/story/components-box--default' +storybook: '/brand/storybook/?path=/story/components-box--playground' description: Use a box to simplify the process of applying one-off styles to an element --- diff --git a/packages/react/src/Accordion/Accordion.examples.stories.tsx b/packages/react/src/Accordion/Accordion.examples.stories.tsx new file mode 100644 index 000000000..c695810ab --- /dev/null +++ b/packages/react/src/Accordion/Accordion.examples.stories.tsx @@ -0,0 +1,68 @@ +import {Meta} from '@storybook/react' +import React from 'react' +import {Accordion} from '.' +import {UnorderedList} from '../' + +export default { + title: 'Components/Accordion/Examples', + component: Accordion, +} as Meta + +export const Composition = () => ( + <> + + What's included in the GitHub for Startups offer? + +

+ All GitHub for Startups companies receive up to 20 seats of GitHub Enterprise for free for year one and 50% + off year two. Learn more about the features and capabilities of GitHub Enterprise{' '} + + here + + . +

+
+
+ + Who is eligible to apply? + +

Startups who meet the following criteria are eligible to apply for the program:

+ + Must be associated with a current GitHub for Startups partner. + Self-funded or funded (Seed-Series A) + Not a current GitHub Enterprise customer + Must not have previously received credits for GitHub Enterprise + +
+
+ + What if my startup is not eligible? Are there other resources for me? + +

+ If you’re not currently eligible for the GitHub for Startups but would like to try GitHub Enterprise, please + feel to sign up for a trial{' '} + + here + + . +

+
+
+ + How can my organization become a GitHub for Startups partner? + +

+ Any investor, accelerator, or startup support organization is eligible to apply for the GitHub for Startups + program. +

+

+ {' '} + + Apply here + + . +

+
+
+ +) diff --git a/packages/react/src/Accordion/Accordion.stories.tsx b/packages/react/src/Accordion/Accordion.stories.tsx index bf615006f..90e73f012 100644 --- a/packages/react/src/Accordion/Accordion.stories.tsx +++ b/packages/react/src/Accordion/Accordion.stories.tsx @@ -1,7 +1,6 @@ import {Meta} from '@storybook/react' import React from 'react' import {Accordion} from '.' -import {UnorderedList} from '../' export default { title: 'Components/Accordion', @@ -18,61 +17,62 @@ export const Default = () => ( ) -export const Composition = () => ( - <> - - What's included in the GitHub for Startups offer? - -

- All GitHub for Startups companies receive up to 20 seats of GitHub Enterprise for free for year one and 50% - off year two. Learn more about the features and capabilities of GitHub Enterprise{' '} - - here - - . -

-
-
- - Who is eligible to apply? - -

Startups who meet the following criteria are eligible to apply for the program:

- - Must be associated with a current GitHub for Startups partner. - Self-funded or funded (Seed-Series A) - Not a current GitHub Enterprise customer - Must not have previously received credits for GitHub Enterprise - -
-
- - What if my startup is not eligible? Are there other resources for me? - -

- If you’re not currently eligible for the GitHub for Startups but would like to try GitHub Enterprise, please - feel to sign up for a trial{' '} - - here - - . -

-
-
- - How can my organization become a GitHub for Startups partner? - -

- Any investor, accelerator, or startup support organization is eligible to apply for the GitHub for Startups - program. -

-

- {' '} - - Apply here - - . -

-
-
- +export const Playground = args => ( + + {args.heading} + {args.content} + ) +Playground.argTypes = { + variant: { + name: 'variant', + control: { + type: 'radio', + }, + options: ['default', 'emphasis'], + }, + heading: { + name: 'text', + control: { + type: 'text', + }, + table: { + category: 'Accordion.Heading', + }, + }, + reversedToggles: { + name: 'reversedToggles', + control: { + type: 'boolean', + }, + table: { + category: 'Accordion.Heading', + }, + }, + headingAs: { + name: 'as', + control: { + type: 'inline-radio', + }, + options: ['h2', 'h3', 'h4', 'h5', 'h6'], + table: { + category: 'Accordion.Heading', + }, + }, + content: { + name: 'text', + control: { + type: 'text', + }, + table: { + category: 'Accordion.Content', + }, + }, +} +Playground.args = { + variant: 'default', + heading: 'Heading', + reversedToggles: false, + headingAs: 'h4', + content: 'Content', +} diff --git a/packages/react/src/ActionMenu/ActionMenu.stories.tsx b/packages/react/src/ActionMenu/ActionMenu.stories.tsx index fdc0dbe6a..f8f272b3f 100644 --- a/packages/react/src/ActionMenu/ActionMenu.stories.tsx +++ b/packages/react/src/ActionMenu/ActionMenu.stories.tsx @@ -1,4 +1,4 @@ -import {Meta, StoryFn} from '@storybook/react' +import {Meta} from '@storybook/react' import React from 'react' import {ActionMenu} from './ActionMenu' @@ -7,8 +7,8 @@ export default { component: ActionMenu, } as Meta -const Template: StoryFn = args => ( - alert(newValue)}> +export const Default = () => ( + alert(newValue)}> Open menu @@ -20,4 +20,45 @@ const Template: StoryFn = args => ( ) -export const Default = Template.bind({}) +export const Playground = args => ( + alert(newValue)}> + {args.buttonText} + + {args.items.map(item => ( + + ))} + + +) +Playground.argTypes = { + buttonText: { + name: 'text', + control: {type: 'text'}, + table: { + category: 'ActionMenu.Button', + }, + }, + items: { + name: 'Menu items', + control: {type: 'object'}, + table: { + category: 'Story customization', + }, + }, +} +Playground.args = { + selectionVariant: 'none', + size: 'medium', + disabled: false, + menuAlignment: 'start', + menuSide: 'outside-bottom', + buttonText: 'Open menu', + items: [ + {value: 'Copy link pressed', children: 'Copy link', selected: true, disabled: false}, + {value: 'Quote reply pressed', children: 'Quote reply', selected: false, disabled: false}, + {value: 'Edit comment pressed', children: 'Edit comment', selected: false, disabled: false}, + ], +} +Playground.parameters = { + controls: {include: ['Menu items', 'text', ...Object.keys(Playground.args)]}, +} diff --git a/packages/react/src/AnchorNav/AnchorNav.stories.tsx b/packages/react/src/AnchorNav/AnchorNav.stories.tsx index 6733149ba..6c26b9184 100644 --- a/packages/react/src/AnchorNav/AnchorNav.stories.tsx +++ b/packages/react/src/AnchorNav/AnchorNav.stories.tsx @@ -14,66 +14,20 @@ export default { parameters: { layout: 'fullscreen', }, - args: { - enableDefaultBgColor: true, - data: { - ['GitHub vs Jenkins']: 'githubvsjenkins', - ['GitHub vs GitLab']: 'githubvsgitlab', - ['GitHub vs CircleCI']: 'githubvscircleci', - ['GitHub vs BitBucket']: 'githubvsvsbitbucket', - ['GitHub vs TravisCI']: 'githubvsvstravis', - }, - sectionHeight: 1000, - offset: 100, - }, - argTypes: { - data: { - name: 'Data', - description: 'Test data', - control: { - type: 'object', - }, - table: { - category: 'Story customization', - }, - }, - sectionHeight: { - name: 'Section height', - description: 'Section height', - control: { - type: 'number', - }, - table: { - category: 'Story customization', - }, - }, - offset: { - name: 'Offset', - description: 'Offset from the top of the page', - control: { - type: 'number', - }, - table: { - category: 'Story customization', - }, - }, - }, } as Meta -export const Default = ({data, ...args}: {data: MockData}) => { - return ( - - Section one - Section two - Section three - Section four - Section five - Sign up - - ) -} +export const Default = () => ( + + Section one + Section two + Section three + Section four + Section five + Sign up + +) -export const Playground = ({data, ...args}: {data: MockData; offset: number; sectionHeight: number}) => { +export const Playground = ({data, sectionHeight, actionText, secondaryAction, secondaryActionText, ...args}) => { return (
@@ -87,12 +41,13 @@ export const Playground = ({data, ...args}: {data: MockData; offset: number; sec - {Object.entries(data).map(([key, value]) => ( + {Object.entries(data as MockData).map(([key, value]) => ( {key} ))} - Sign up + {actionText} + {secondaryAction && {secondaryActionText}} {/** * The following markup is provided for demonstration purposes only. @@ -105,7 +60,7 @@ export const Playground = ({data, ...args}: {data: MockData; offset: number; sec style={{marginBottom: '100px'}} padding="none" > - {Object.entries(data).map(([key, value]) => ( + {Object.entries(data as MockData).map(([key, value]) => ( {key} @@ -128,3 +83,72 @@ export const Playground = ({data, ...args}: {data: MockData; offset: number; sec
) } +Playground.argTypes = { + actionText: { + name: 'text', + control: {type: 'text'}, + table: { + category: 'AnchorNav.Action', + }, + }, + secondaryAction: { + name: 'visible', + control: {type: 'boolean'}, + table: { + category: 'AnchorNav.SecondaryAction', + }, + }, + secondaryActionText: { + name: 'text', + control: {type: 'text'}, + table: { + category: 'AnchorNav.SecondaryAction', + }, + }, + data: { + name: 'Data', + description: 'Test data', + control: { + type: 'object', + }, + table: { + category: 'Story customization', + }, + }, + sectionHeight: { + name: 'Section height', + description: 'Section height', + control: { + type: 'number', + }, + table: { + category: 'Story customization', + }, + }, + offset: { + name: 'Offset', + description: 'Offset from the top of the page', + control: { + type: 'number', + }, + table: { + category: 'Story customization', + }, + }, +} +Playground.args = { + hideUntilSticky: false, + enableDefaultBgColor: false, + actionText: 'Sign up', + secondaryAction: false, + secondaryActionText: 'Learn more', + data: { + ['GitHub vs Jenkins']: 'githubvsjenkins', + ['GitHub vs GitLab']: 'githubvsgitlab', + ['GitHub vs CircleCI']: 'githubvscircleci', + ['GitHub vs BitBucket']: 'githubvsvsbitbucket', + ['GitHub vs TravisCI']: 'githubvsvstravis', + }, + sectionHeight: 1000, + offset: 100, +} diff --git a/packages/react/src/Avatar/Avatar.stories.tsx b/packages/react/src/Avatar/Avatar.stories.tsx index ad241a0b6..284c0af80 100644 --- a/packages/react/src/Avatar/Avatar.stories.tsx +++ b/packages/react/src/Avatar/Avatar.stories.tsx @@ -7,46 +7,65 @@ import placeholderAvatar from '../fixtures/images/avatar-mona.png' export default { title: 'Components/Avatar', component: Avatar, - args: { - size: AvatarSizes[1], - shape: 'circle', - src: placeholderAvatar, - alt: 'A random avatar picture', - }, - argTypes: { - size: { - description: 'The size of the Avatar', - control: { - type: 'radio', - options: AvatarSizes, - }, +} as Meta + +export const Default = () => ( + +) + +export const Playground: StoryFn = args => +Playground.argTypes = { + shape: { + description: 'The shape of the Avatar', + options: AvatarShapes, + control: { + type: 'radio', }, - shape: { - description: 'The shape of the Avatar', - control: { - type: 'radio', - options: AvatarShapes, - }, + }, + src: { + description: 'The url of the image to display', + type: {name: 'string', required: true}, + control: { + type: 'text', }, - src: { - description: 'The url of the image to display', - type: {name: 'string', required: true}, - control: { - type: 'text', - }, + }, + alt: { + description: 'The alt text for the image', + type: {name: 'string', required: true}, + control: { + type: 'text', }, - alt: { - description: 'The alt text for the image', - type: {name: 'string', required: true}, - control: { - type: 'text', - }, + }, + size: { + description: 'The size of the Avatar', + options: AvatarSizes, + control: { + type: 'radio', }, }, -} as Meta +} +Playground.args = { + shape: 'circle', + src: placeholderAvatar, + alt: 'A random avatar picture', + size: AvatarSizes[1], +} -export const Playground: StoryFn = args => - -export const Default = () => ( - -) +export const Playground2: StoryFn = args => +Playground2.argTypes = { + ...Playground.argTypes, + size: { + control: { + type: 'object', + }, + }, +} +Playground2.args = { + ...Playground.args, + size: { + narrow: AvatarSizes[1], + regular: AvatarSizes[2], + wide: AvatarSizes[3], + }, +} +Playground2.storyName = 'Playground (responsive)' diff --git a/packages/react/src/Box/Box.stories.tsx b/packages/react/src/Box/Box.stories.tsx index 0425382b8..90be4958e 100644 --- a/packages/react/src/Box/Box.stories.tsx +++ b/packages/react/src/Box/Box.stories.tsx @@ -1,7 +1,14 @@ import React from 'react' import {Meta, StoryFn} from '@storybook/react' -import {Box} from './Box' +import { + Box, + BoxBackgroundColors, + BoxBorderColorOptions, + BoxBorderRadiusOptions, + BoxBorderWidthOptions, + BoxSpacingValues, +} from './Box' import {Text} from '../' export default { @@ -9,10 +16,67 @@ export default { component: Box, } as Meta -const Template: StoryFn = args => ( - +export const Default = () => ( + Default Box ) -export const Default = Template.bind({}) +export const Playground: StoryFn = args => ( + + Default Box + +) +Playground.args = { + padding: 'normal', + margin: 'normal', + backgroundColor: 'inset', + borderRadius: 'medium', + borderWidth: 'thin', + borderColor: 'default', + borderStyle: 'solid', +} +Playground.argTypes = { + padding: { + options: BoxSpacingValues, + control: { + type: 'select', + }, + }, + margin: { + options: BoxSpacingValues, + control: { + type: 'select', + }, + }, + backgroundColor: { + options: BoxBackgroundColors, + control: { + type: 'inline-radio', + }, + }, + borderRadius: { + options: BoxBorderRadiusOptions, + control: { + type: 'inline-radio', + }, + }, + borderWidth: { + options: BoxBorderWidthOptions, + control: { + type: 'inline-radio', + }, + }, + borderColor: { + options: BoxBorderColorOptions, + control: { + type: 'inline-radio', + }, + }, + borderStyle: { + options: ['none', 'solid'], + control: { + type: 'inline-radio', + }, + }, +}