Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Basic storybook implementation #1636

Merged
merged 35 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8a96c2e
install & configure storybook (via magic npx script)
haszari Jan 23, 2020
0c27294
fix indentation in storybook generated files
haszari Jan 23, 2020
f4387dc
eslint ignore generated storybook files (for now at least)
haszari Jan 23, 2020
051b3de
unhide storybook folder, consistent with Gutenberg project
haszari Jan 23, 2020
f263aed
demo story for one of our components (with no css/styles)
haszari Jan 23, 2020
9138151
hack in scss webpack config & add story for button:
haszari Jan 23, 2020
6d10ace
git ignore storybook-static build folder
haszari Jan 23, 2020
687509b
pin dependencies for storybook
haszari Jan 23, 2020
fe6d629
piggy-back off main webpack config for storybook module.rules (for scss)
haszari Jan 24, 2020
1780f9e
use gutenberg (wp-components) styles in storybook
haszari Jan 24, 2020
83e085c
use system font for storybook, consistent with wp-admin/gberg and rea…
haszari Jan 24, 2020
141455a
add --ci flag to prevent storybook opening new browser tab…
haszari Jan 24, 2020
a50dfbd
rename default stories to Default (following Gutenberg pattern)
haszari Jan 24, 2020
d9f9eed
add story for ErrorPlaceholder
haszari Jan 24, 2020
5d05fa9
failing ProductPreview story (committing to PR as an example for disc…
haszari Jan 24, 2020
896335f
storybook for components/icons
haszari Jan 24, 2020
a6dbd97
fix aliased dependencies in components for storybook:
haszari Jan 27, 2020
bf921fd
basic story for PriceSlider (looks right but interaction broken)
haszari Jan 27, 2020
482fc99
fix PriceSlider user interaction:
haszari Jan 27, 2020
728892a
add comment about priceslider max/min (todoish)
haszari Jan 27, 2020
5fe188f
remove default stories from storybook scaffolding
haszari Jan 27, 2020
52aead2
organise stories by module (aka folder in codebase)
haszari Jan 27, 2020
60fd111
package-lock update after rebase
haszari Jan 27, 2020
fd6b9f8
remove unnecessary ignores (default stories are gone)
haszari Jan 27, 2020
b2c9bda
delete experimental/risky/broken stories:
haszari Jan 30, 2020
47ac863
remove unnecessary import
haszari Jan 30, 2020
7483d9e
clarify PriceSlider component intended usage comment in story
haszari Jan 30, 2020
3c0909f
remove redundant wrapper divs from stories
haszari Jan 30, 2020
8d584da
add common storybook addons (used by Gutenberg storybook)
haszari Jan 30, 2020
2eb1890
rebuild package.lock after rebase
haszari Jan 30, 2020
6b9293a
remove unnecessary wrapper div
haszari Jan 30, 2020
3574a99
package fixes after rebase
haszari Jan 30, 2020
0a353ac
add configuration for storybook source loader
nerrad Jan 30, 2020
d922bd5
add decorators for a11y and knobs plugins
nerrad Jan 30, 2020
20b9d79
remove unnecessary react import & import useState from WP
haszari Jan 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ languages
node_modules
vendor
legacy

# ignore various storybook generated files for now (we may be able to trim this down or take ownership of these files)
stories/0-Welcome.stories.js
stories/1-Button.stories.js
nerrad marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion assets/js/base/components/button/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
import React from 'react';
import { Button as WPButton } from 'wordpress-components';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down
6 changes: 1 addition & 5 deletions assets/js/base/components/button/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ export default {
component: Button,
};

export const Default = () => (
<div>
<Button>Buy now</Button>
</div>
);
export const Default = () => <Button>Buy now</Button>;
45 changes: 21 additions & 24 deletions assets/js/base/components/price-slider/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,29 @@ export default {
};

export const Default = () => {
// PriceSlider expects client to update min & max price
// is this a bug? not fully self-contained
// PriceSlider expects client to update min & max price, i.e. is a controlled component
const [ min, setMin ] = useState( 1000 );
const [ max, setMax ] = useState( 5000 );
return (
<div>
<PriceSlider
minPrice={ min }
maxPrice={ max }
onChange={ ( values ) => {
setMin( values[ 0 ] );
setMax( values[ 1 ] );
} }
minConstraint={ 1000 }
maxConstraint={ 5000 }
step={ 250 }
currency={ {
code: 'nzd',
symbol: '$',
thousandSeparator: ' ',
decimalSeparator: '.',
minorUnit: 2,
prefix: '$',
suffix: '',
} }
/>
</div>
<PriceSlider
minPrice={ min }
maxPrice={ max }
onChange={ ( values ) => {
setMin( values[ 0 ] );
setMax( values[ 1 ] );
} }
minConstraint={ 1000 }
maxConstraint={ 5000 }
step={ 250 }
currency={ {
code: 'nzd',
symbol: '$',
thousandSeparator: ' ',
decimalSeparator: '.',
minorUnit: 2,
prefix: '$',
suffix: '',
} }
/>
);
};
16 changes: 7 additions & 9 deletions assets/js/components/error-placeholder/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ export default {
};

export const Default = () => (
<div>
<ErrorPlaceholder
error={ {
message:
'Unfortunately, we seem to have encountered a slight problem',
type: 'general',
} }
/>
</div>
<ErrorPlaceholder
error={ {
message:
'Unfortunately, we seem to have encountered a slight problem',
type: 'general',
} }
/>
);
141 changes: 0 additions & 141 deletions assets/js/components/icons/stories/index.js

This file was deleted.

27 changes: 0 additions & 27 deletions assets/js/components/product-preview/sad-stories/index.js

This file was deleted.

Loading