-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add storybook guide in readme and contributing, customize storybook t…
…heme and add stories eexamples
- Loading branch information
1 parent
9a56903
commit aaeb41c
Showing
14 changed files
with
339 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {addons} from '@storybook/addons'; | ||
import {create} from '@storybook/theming'; | ||
|
||
addons.setConfig({ | ||
panelPosition: 'bottom', | ||
|
||
theme: create({ | ||
base: 'light', | ||
|
||
// UI | ||
appBorderRadius: 4, | ||
appBg: '#FFFFFF', | ||
contentBg: '#FFFFFF', | ||
textColor: '#3f3f40', | ||
|
||
// Typography | ||
fontBase: '"Fabriga", sans-serif', | ||
fontCode: 'monospace', | ||
|
||
|
||
brandTitle: 'VTEX Styleguide', | ||
brandUrl: '/', | ||
brandImage: null, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react' | ||
import { addParameters, addDecorator } from '@storybook/react' | ||
import '@storybook/addon-console' | ||
import 'vtex-tachyons' | ||
|
||
addParameters({ | ||
options: { | ||
showNav: true, | ||
showPanel: true, // show the code panel by default | ||
}, | ||
}) | ||
|
||
addDecorator(story => (<div style={{padding: '10px'}}>{story()}</div>)) // Add padding in the canvas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,61 @@ | ||
import React from 'react' | ||
import { withA11y } from '@storybook/addon-a11y' | ||
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs" | ||
import { action } from '@storybook/addon-actions' | ||
|
||
import Button from '.' | ||
|
||
export default { | ||
title: 'Button', | ||
title: 'Components|Button', | ||
component: Button, | ||
decorators: [withA11y, withKnobs] | ||
} | ||
|
||
export const withText = () => ( | ||
<Button type="primary"> | ||
With a text | ||
const variations = ['primary', 'secondary', 'tertiary', 'danger', 'danger-tertiary', 'inverted-tertiary'] | ||
|
||
export const Default = () => ( | ||
<Button | ||
variation={select('Variation', variations, 'primary')} | ||
isLoading={boolean('Is loading', false)} | ||
disabled={boolean('Disabled', false)} | ||
block={boolean('Block', false)} | ||
size={select('Size', ['small', 'regular', 'large'], 'regular')} | ||
onClick={action('button-click')} | ||
onFocus={action('button-focus')} | ||
> | ||
{text("Label", "With a text")} | ||
</Button> | ||
) | ||
|
||
export const withLoadingState = () => ( | ||
<Button | ||
isLoading={true} | ||
> | ||
Loading | ||
</Button> | ||
) | ||
|
||
export const withDiffentVariations = () => ( | ||
<> | ||
{variations.map(variation => ( | ||
<> | ||
<Button variation={variation}>{variation}</Button> | ||
<br/> | ||
<br/> | ||
</> | ||
))} | ||
</> | ||
) | ||
|
||
export const withOnMouseEvents = () => ( | ||
<Button | ||
onMouseDown={action('button-on-mouse-down')} | ||
onMouseEnter={action('button-on-mouse-enter')} | ||
onMouseOver={action('button-on-mouse-over')} | ||
onMouseLeave={action('button-on-mouse-leave')} | ||
onMouseOut={action('button-on-mouse-out')} | ||
onMouseUp={action('button-on-mouse-up')} | ||
> | ||
Button | ||
</Button> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
import React from 'react' | ||
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs" | ||
|
||
import Tooltip from '.' | ||
import Button from '../Button' | ||
|
||
export default { | ||
title: 'Tooltip', | ||
title: 'Components|Tooltip', | ||
component: Tooltip, | ||
decorators: [withKnobs] | ||
} | ||
|
||
export const tooltipTop = () => ( | ||
<Tooltip label="tooltip text"> | ||
<span>oi</span> | ||
export const Default = () => ( | ||
<Tooltip | ||
label={text('Label', 'Tooltip Label')} | ||
trigger={select('Trigger', ['click', 'hover', 'focus'], 'hover')} | ||
wordBreak={select('Word Break', ['normal', 'break-all', 'keep-all', 'break-word'], 'normal')} | ||
position={select('Position', ['top', 'left', 'right', 'bottom'], 'left')} | ||
> | ||
<Button>Button</Button> | ||
</Tooltip> | ||
) | ||
|
||
export const AlwaysVisible = () => ( | ||
<Tooltip label="Tooltip Label" trigger="focus"> | ||
<Button autoFocus={true}>Button with focus</Button> | ||
</Tooltip> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react' | ||
/* | ||
This story should contain all our components. | ||
*/ | ||
const All = () => (<h1>Under construction</h1>) | ||
|
||
export default All |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react' | ||
|
||
/* | ||
This story should have an example page using our components. | ||
*/ | ||
const ExamplePage = () => (<h1>Under construction</h1>) | ||
|
||
export default ExamplePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import PageHeader from '../PageHeader' | ||
import PageBlock from '../PageBlock' | ||
import Layout from '../Layout' | ||
|
||
const Playground = () => ( | ||
<Layout | ||
fullWidth | ||
pageHeader={<PageHeader title="Playground"/>} | ||
> | ||
<PageBlock> | ||
{/* Add your code here, don't forget to delete after */} | ||
</PageBlock> | ||
</Layout> | ||
) | ||
|
||
export default Playground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Playground from './Playground' | ||
import ExamplePage from './ExamplePage' | ||
import All from './All' | ||
|
||
export default { | ||
title: 'Playground|Playground' | ||
} | ||
|
||
export { Playground, ExamplePage, All } |
Oops, something went wrong.