Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
Revert "chore: Upgrade Storybook to v4 (#1498)"
Browse files Browse the repository at this point in the history
This reverts commit e60b1c8.
  • Loading branch information
Akira Sudoh committed Nov 1, 2018
1 parent 31ef693 commit 5953496
Show file tree
Hide file tree
Showing 317 changed files with 1,845 additions and 2,615 deletions.
28 changes: 13 additions & 15 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import React from 'react';
import { configure, addDecorator } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { withOptions } from '@storybook/addon-options';
// import { checkA11y } from 'storybook-addon-a11y';
import { configure, setAddon, addDecorator } from '@storybook/react';
import infoAddon, { setDefaults } from '@storybook/addon-info';
import { setOptions } from '@storybook/addon-options';
import { checkA11y } from 'storybook-addon-a11y';
import Container from './Container';

addDecorator(
withInfo({
maxPropStringLength: 200, // Displays the first 200 characters in the default prop string
})
);
setOptions({
name: `carbon components react`,
url: 'https://github.com/IBM/carbon-components-react',
});

addDecorator(
withOptions({
name: `carbon components react`,
url: 'https://github.com/IBM/carbon-components-react',
})
);
// addon-info defaults
setDefaults({
maxPropStringLength: 200, // Displays the first 200 characters in the default prop string
});
setAddon(infoAddon);

addDecorator(story => <Container story={story} />);
// addDecorator(checkA11y);
Expand Down
8 changes: 5 additions & 3 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const useExperimentalFeatures =
process.env.CARBON_USE_EXPERIMENTAL_FEATURES === 'true';
Expand Down Expand Up @@ -88,14 +88,16 @@ module.exports = {
test: /\.scss$/,
use: !useExternalCss
? [{ loader: 'style-loader' }, ...styleLoaders]
: [{ loader: MiniCssExtractPlugin.loader }, ...styleLoaders],
: ExtractTextPlugin.extract({
use: styleLoaders,
}),
},
],
},
plugins: !useExternalCss
? []
: [
new MiniCssExtractPlugin({
new ExtractTextPlugin({
filename: '[name].[contenthash].css',
}),
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-preset-flow-7.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-runtime-7.1.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-cache-0.8.8.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-core-0.13.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-css-0.9.8.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-hash-0.6.6.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-memoize-0.6.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-provider-0.11.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-serialize-0.9.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-sheet-0.8.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-styled-0.10.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-styled-base-0.10.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-stylis-0.7.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-unitless-0.6.7.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-utils-0.8.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@emotion-weak-memoize-0.1.3.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-addons-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-channels-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-components-4.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@storybook-core-3.4.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-core-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/@storybook-react-3.4.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-react-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/@storybook-ui-3.4.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@storybook-ui-4.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@webassemblyjs-ast-1.7.10.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@webassemblyjs-utf8-1.7.10.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@xtuc-ieee754-1.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@xtuc-long-4.2.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-2.7.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-bigint-0.2.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-class-fields-0.1.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-es7-0.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-import-meta-0.2.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/acorn-stage3-0.6.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ansi-align-2.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ansi-colors-3.2.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/app-root-dir-1.0.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/async-2.6.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/autoprefixer-7.2.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/autoprefixer-9.3.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/babel-helper-is-void-0-0.4.3.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/babel-loader-7.1.5.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/babel-loader-8.0.4.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/babel-plugin-macros-2.4.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/babel-preset-minify-0.5.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/bluebird-3.5.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/boxen-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/brace-expansion-1.1.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/browserslist-4.3.4.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/camelcase-5.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/caniuse-lite-1.0.30000900.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/chrome-trace-event-1.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/clean-css-4.2.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/cli-boxes-1.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/cli-table3-0.5.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/colors-1.3.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/commander-2.19.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/copy-to-clipboard-3.0.8.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/core-js-2.5.7.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/css-loader-0.28.11.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/csstype-2.5.3.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/detect-port-1.2.3.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/dotenv-6.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/dotenv-expand-4.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ejs-2.6.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/electron-to-chromium-1.3.82.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/enhanced-resolve-4.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/events-2.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/events-3.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/external-editor-2.2.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/file-loader-2.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/file-system-cache-1.0.5.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/filesize-3.5.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/filesize-3.6.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/find-cache-dir-2.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/fs-extra-0.30.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/fuse.js-3.3.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/glamorous-4.13.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/gzip-size-3.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/he-1.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/html-minifier-3.5.21.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/inquirer-3.3.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/insert-css-2.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ip-1.1.5.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/is-root-1.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/is-root-2.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/json5-2.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/keycode-2.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/lazy-universal-dotenv-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/lodash.throttle-4.1.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/loose-envify-1.4.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/make-error-1.3.4.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/make-error-1.3.5.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/marked-0.3.19.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/marksy-6.0.3.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/marksy-6.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/mime-2.3.1.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/minimatch-3.0.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/moment-2.22.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/node-fetch-2.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/node-releases-1.0.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/object-assign-3.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/opn-5.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/opn-5.4.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/pkg-up-2.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-loader-2.1.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-value-parser-3.3.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/prettier-1.14.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/prettier-1.14.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/prop-types-15.6.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/qs-6.5.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ramda-0.21.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/raw-loader-0.5.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/react-datetime-2.14.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/react-dev-utils-5.0.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-dev-utils-6.0.5.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-error-overlay-5.0.5.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-inspector-2.3.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/react-modal-3.5.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-modal-3.6.1.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/react-split-pane-0.1.82.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-split-pane-0.1.84.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/react-treebeard-3.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/recursive-readdir-2.2.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/recursive-readdir-2.2.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/redux-4.0.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/regenerator-runtime-0.12.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/render-fragment-0.1.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/resolve-1.8.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/serve-favicon-2.5.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/shallowequal-1.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/sockjs-client-1.1.4.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/sockjs-client-1.1.5.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/style-loader-0.20.3.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/style-loader-0.23.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/svg-url-loader-2.3.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/tapable-1.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/term-size-1.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/toggle-selection-1.0.6.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/uglify-js-3.4.9.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/url-loader-1.1.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/velocity-react-1.4.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/watchpack-1.6.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/webpack-3.12.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/webpack-4.23.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/webpack-log-2.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/webpack-sources-1.3.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/widest-line-2.0.1.tgz
Binary file not shown.
9 changes: 5 additions & 4 deletions docs/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ import readme from './README.md';

storiesOf('ComponentName', module).add(
'story-title',
withReadme(readme, () => <ComponentExample />, {
info: {
withReadme(
readme,
withInfo({
text: 'Information for the given story',
},
})
})(() => <ComponentExample />)
)
);
```
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,17 @@
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@storybook/addon-actions": "^4.0.0",
"@storybook/addon-info": "^4.0.0",
"@storybook/addon-knobs": "^4.0.0",
"@storybook/addon-links": "^4.0.0",
"@storybook/addon-options": "^4.0.0",
"@storybook/addon-storysource": "^4.0.0",
"@storybook/addons": "^4.0.0",
"@storybook/react": "^4.0.0",
"@storybook/addon-actions": "^3.4.11",
"@storybook/addon-info": "^3.4.11",
"@storybook/addon-knobs": "^3.4.11",
"@storybook/addon-options": "^3.4.11",
"@storybook/addon-storysource": "^3.4.11",
"@storybook/addons": "^3.4.11",
"@storybook/react": "^3.4.11",
"all-contributors-cli": "^5.2.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-react-docgen": "^2.0.0",
"bowser": "^1.6.1",
Expand All @@ -185,13 +183,13 @@
"eslint-plugin-jsdoc": "^3.9.1",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"extract-text-webpack-plugin": "^3.0.0",
"gzip-size": "^5.0.0",
"husky": "^1.1.2",
"jest": "^23.6.0",
"jest-circus": "^23.6.0",
"lcov2badge": "^0.1.0",
"lint-staged": "^7.3.0",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "4.9.2",
"object-assign": "^4.1.1",
"postcss-loader": "^3.0.0",
Expand All @@ -216,7 +214,6 @@
"storybook-readme": "^4.0.2",
"string-replace-loader": "^2.1.0",
"validate-commit-msg": "^2.10.1",
"webpack": "^4.23.1",
"whatwg-fetch": "^2.0.3"
},
"resolutions": {
Expand Down
31 changes: 13 additions & 18 deletions src/components/Accordion/Accordion-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withInfo } from '@storybook/addon-info';
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
import Accordion from '../Accordion';
import AccordionItem from '../AccordionItem';
Expand All @@ -19,7 +20,11 @@ storiesOf('Accordion', module)
.addDecorator(withKnobs)
.add(
'Default',
() => (
withInfo({
text: `
Accordions allow users to expand and collapse sections of content.
`,
})(() => (
<Accordion>
<AccordionItem
title={text('The title (title)', 'Section 1 title')}
Expand Down Expand Up @@ -71,27 +76,17 @@ storiesOf('Accordion', module)
</p>
</AccordionItem>
</Accordion>
),
{
info: {
text: `
Accordions allow users to expand and collapse sections of content.
`,
},
}
))
)
.add(
'skeleton',
() => (
withInfo({
text: `
Placeholder skeleton state to use when content is loading.
`,
})(() => (
<div style={{ width: '500px' }}>
<AccordionSkeleton />
</div>
),
{
info: {
text: `
Accordions allow users to expand and collapse sections of content.
`,
},
}
))
);
29 changes: 14 additions & 15 deletions src/components/Breadcrumb/Breadcrumb-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withInfo } from '@storybook/addon-info';
import { withKnobs, boolean } from '@storybook/addon-knobs';
import Breadcrumb from '../Breadcrumb';
import BreadcrumbItem from '../BreadcrumbItem';
Expand All @@ -18,27 +19,25 @@ storiesOf('Breadcrumb', module)
.addDecorator(withKnobs)
.add(
'Default',
() => (
withInfo({
text: `
Breadcrumb enables users to quickly see their location within a path of navigation and move up to a parent level if desired.
`,
})(() => (
<Breadcrumb {...props()}>
<BreadcrumbItem>
<a href="/#">Breadcrumb 1</a>
</BreadcrumbItem>
<BreadcrumbItem href="#">Breadcrumb 2</BreadcrumbItem>
<BreadcrumbItem href="#">Breadcrumb 3</BreadcrumbItem>
</Breadcrumb>
),
{
info: {
text: `
Breadcrumb enables users to quickly see their location within a path of navigation and move up to a parent level if desired.
`,
},
}
))
)
.add('skeleton', () => <BreadcrumbSkeleton />, {
info: {
.add(
'skeleton',
withInfo({
text: `
Placeholder skeleton state to use when content is loading.
`,
},
});
Placeholder skeleton state to use when content is loading.
`,
})(() => <BreadcrumbSkeleton />)
);
100 changes: 46 additions & 54 deletions src/components/Button/Button-story.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withInfo } from '@storybook/addon-info';
import { withKnobs, boolean, select } from '@storybook/addon-knobs';
import { iconAddSolid, iconSearch } from 'carbon-icons';
import Button from '../Button';
import ButtonSkeleton from '../Button/Button.Skeleton';

const icons = {
None: 'None',
'Add with filled circle (iconAddSolid from `carbon-icons`)': 'iconAddSolid',
'Search (iconSearch from `carbon-icons`)': 'iconSearch',
none: 'None',
iconAddSolid: 'Add with filled circle (iconAddSolid from `carbon-icons`)',
iconSearch: 'Search (iconSearch from `carbon-icons`)',
};

const iconMap = {
Expand All @@ -18,11 +19,11 @@ const iconMap = {
};

const kinds = {
'Primary button (primary)': 'primary',
'Secondary button (secondary)': 'secondary',
'Danger button (danger)': 'danger',
'Danger primary button (danger--primary)': 'danger--primary',
'Ghost button (ghost)': 'ghost',
primary: 'Primary button (primary)',
secondary: 'Secondary button (secondary)',
danger: 'Danger button (danger)',
'danger--primary': 'Danger primary button (danger--primary)',
ghost: 'Ghost button (ghost)',
};

const props = {
Expand All @@ -49,7 +50,30 @@ storiesOf('Buttons', module)
.addDecorator(withKnobs)
.add(
'Default',
() => {
withInfo({
text: `
Buttons are used to initialize an action, either in the background or
foreground of an experience.
There are several kinds of buttons.
Primary buttons should be used for the principle call to action
on the page.
Secondary buttons should be used for secondary actions on each page.
Danger buttons should be used for a negative action (such as Delete) on the page.
Modify the behavior of the button by changing its event properties.
Small buttons may be used when there is not enough space for a
regular sized button. This issue is most found in tables. Small button should have three words
or less.
When words are not enough, icons can be used in buttons to better communicate what the button does. Icons are
always paired with text.
`,
})(() => {
const regularProps = props.regular();
return (
<div style={{ display: 'flex', alignItems: 'center' }}>
Expand All @@ -63,37 +87,15 @@ storiesOf('Buttons', module)
&nbsp;
</div>
);
},
{
info: {
text: `
Buttons are used to initialize an action, either in the background or
foreground of an experience.
There are several kinds of buttons.
Primary buttons should be used for the principle call to action
on the page.
Secondary buttons should be used for secondary actions on each page.
Danger buttons should be used for a negative action (such as Delete) on the page.
Modify the behavior of the button by changing its event properties.
Small buttons may be used when there is not enough space for a
regular sized button. This issue is most found in tables. Small button should have three words
or less.
When words are not enough, icons can be used in buttons to better communicate what the button does. Icons are
always paired with text.
`,
},
}
})
)
.add(
'Sets of Buttons',
() => {
withInfo({
text: `
When an action required by the user has more than one option, always use a a negative action button (secondary) paired with a positive action button (primary) in that order. Negative action buttons will be on the left. Positive action buttons should be on the right. When these two types buttons are paired in the correct order, they will automatically space themselves apart.
`,
})(() => {
const setProps = props.set();
return (
<div>
Expand All @@ -105,31 +107,21 @@ storiesOf('Buttons', module)
</Button>
</div>
);
},
{
info: {
text: `
When an action required by the user has more than one option, always use a a negative action button (secondary) paired with a positive action button (primary) in that order. Negative action buttons will be on the left. Positive action buttons should be on the right. When these two types buttons are paired in the correct order, they will automatically space themselves apart.
`,
},
}
})
)
.add(
'skeleton',
() => (
withInfo({
text: `
Placeholder skeleton state to use when content is loading.
`,
})(() => (
<div>
<ButtonSkeleton />
&nbsp;
<ButtonSkeleton href="#" />
&nbsp;
<ButtonSkeleton small />
</div>
),
{
info: {
text: `
Placeholder skeleton state to use when content is loading.
`,
},
}
))
);
Loading

0 comments on commit 5953496

Please sign in to comment.