diff --git a/.storybook/addons.js b/.storybook/addons.js new file mode 100644 index 0000000..6622fe4 --- /dev/null +++ b/.storybook/addons.js @@ -0,0 +1 @@ +import '@storybook/addon-knobs/register'; diff --git a/docs/balloons.stories.js b/docs/balloons.stories.js index d9edb41..cfe0208 100644 --- a/docs/balloons.stories.js +++ b/docs/balloons.stories.js @@ -1,5 +1,15 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Balloons', module) - .add('.balloon.from-left', () => '

Hello NES.css

') - .add('.balloon.from-right', () => '

Hello NES.css

'); +const stories = storiesOf('Ballons', module); +stories.addDecorator(withKnobs); + +stories.add('balloon', () => { + const selectedClass = select('class', { + 'balloon from-left': 'balloon from-left', + 'balloon from-right': 'balloon from-right', + }, 'balloon from-left'); + return `

Hello NES.css

`; +}); diff --git a/docs/buttons.stories.js b/docs/buttons.stories.js index 8cff486..8d0ef07 100644 --- a/docs/buttons.stories.js +++ b/docs/buttons.stories.js @@ -1,8 +1,18 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Buttons', module) - .add('button.btn', () => ' ') - .add('button.btn.is-primary', () => '') - .add('button.btn.is-success', () => '') - .add('button.btn.is-warning', () => '') - .add('button.btn.is-error', () => ''); +const stories = storiesOf('Buttons', module); +stories.addDecorator(withKnobs); + +stories.add('button', () => { + const extraClass = select('class', { + btn: 'btn', + 'btn is-primary': 'btn is-primary', + 'btn is-success': 'btn is-success', + 'btn is-warning': 'btn is-warning', + 'btn is-error': 'btn is-error', + }, 'btn'); + return ``; +}); diff --git a/docs/containers.stories.js b/docs/containers.stories.js index 0b179c7..9b92e60 100644 --- a/docs/containers.stories.js +++ b/docs/containers.stories.js @@ -1,35 +1,26 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Containers', module) - .add('.container.with-title', () => `
-

Container

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.with-title.is-center', () => `
-

Container.is-center

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.with-title.is-right', () => `
-

Container.is-right

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.with-title.is_dark', () => `
-

Container

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.with-title.is-center.is-dark', () => `
-

Container.is-center

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.with-title.is-right.is-dark', () => `
-

Container.is-right

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.is-rounded', () => `
-

Container.is-right

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`) - .add('.container.is-rounded.is-dark', () => `
-

Container.is-right

-

Good morning. Thou hast had a good night's sleep, I hope.

-
`); +const stories = storiesOf('Containers', module); +stories.addDecorator(withKnobs); + +stories.add('container', () => { + const selectedClass = select('class', { + container: 'container', + 'container with-title': 'container with-title', + 'container with-title is-center': 'container with-title is-center', + 'container with-title is-right': 'container with-title is-right', + 'container with-title is-dark': 'container with-title is-dark', + 'container with-title is-center is-dark': 'container with-title is-center is-dark', + 'container with-title is-right is-dark': 'container with-title is-right is-dark', + 'container is-rounded': 'container is-rounded', + 'container is-rounded is-dark': 'container is-rounded is-dark', + }, 'container'); + + return `
+

Container

+

Good morning. Thou hast had a good night's sleep, I hope.

+
`; +}); diff --git a/docs/icons.stories.js b/docs/icons.stories.js index be6a53f..86f77ee 100644 --- a/docs/icons.stories.js +++ b/docs/icons.stories.js @@ -1,26 +1,36 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Icons', module) - .add('icon.twitter', () => '') - .add('icon.twitter.is-medium', () => '') - .add('icon.twitter.is-large', () => '') - .add('icon.facebook', () => '') - .add('icon.facebook.is-medium', () => '') - .add('icon.facebook.is-large', () => '') - .add('icon.github', () => '') - .add('icon.github.is-medium', () => '') - .add('icon.github.is-large', () => '') - .add('icon.youtube', () => '') - .add('icon.youtube.is-medium', () => '') - .add('icon.youtube.is-large', () => '') - .add('icon.close', () => '') - .add('icon.close.is-medium', () => '') - .add('icon.close.is-large', () => '') - .add('octocat animate', () => '') - .add('icon.trophy', () => '') - .add('icon.trophy is-medium', () => '') - .add('icon.trophy is-large', () => '') - .add('nes-logo', () => '') - .add('nes-jp-logo', () => '') - .add('snes-logo', () => '') - .add('snes-jp-logo', () => ''); +const stories = storiesOf('Icons', module); +stories.addDecorator(withKnobs); + +stories.add('icon', () => { + const selectedClass = select('class', { + 'icon twitter': 'icon twitter', + 'icon twitter is-medium': 'icon twitter is-medium', + 'icon twitter is-large': 'icon twitter is-large', + 'icon facebook': 'icon facebook', + 'icon facebook is-medium': 'icon facebook is-medium', + 'icon facebook is-large': 'icon facebook is-large', + 'icon github': 'icon github', + 'icon github is-medium': 'icon github is-medium', + 'icon github is-large': 'icon github is-large', + 'icon youtube': 'icon youtube', + 'icon youtube is-medium': 'icon youtube is-medium', + 'icon youtube is-large': 'icon youtube is-large', + 'icon close': 'icon close', + 'icon close is-medium': 'icon close is-medium', + 'icon close is-large': 'icon close is-large', + 'octocat animate': 'octocat animate', + 'icon trophy': 'icon trophy', + 'icon trophy is-medium': 'icon trophy is-medium', + 'icon trophy is-large': 'icon trophy is-large', + 'nes-logo': 'nes-logo', + 'nes-jp-logo': 'nes-jp-logo', + 'snes-logo': 'snes-logo', + 'snes-jp-logo': 'snes-jp-logo', + }, 'icon twitter'); + return ``; +}); diff --git a/docs/inputs.stories.js b/docs/inputs.stories.js index 77f9f2a..109fedb 100644 --- a/docs/inputs.stories.js +++ b/docs/inputs.stories.js @@ -1,7 +1,12 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Inputs', module) - .add('input.radio', () => ` +const stories = storiesOf('Inputs', module); +stories.addDecorator(withKnobs); + +stories.add('input.radio', () => ` `) - .add('input.input', () => ` - `) - .add('input.input.is-success', () => ` - `) - .add('input.input.is-warning', () => ` - `) - .add('input.input.is-error', () => ` - `); + .add('input', () => { + const selectedClass = select('class', { + input: 'input', + 'input is-success': 'input is-success', + 'input is-warning': 'input is-warning', + 'input is-error': 'input is-error', + }, 'input'); + + return ``; + }); diff --git a/docs/table.stories.js b/docs/table.stories.js index ad91d67..082120a 100644 --- a/docs/table.stories.js +++ b/docs/table.stories.js @@ -1,8 +1,18 @@ import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies +import { // eslint-disable-line import/no-extraneous-dependencies + withKnobs, select, +} from '@storybook/addon-knobs'; -storiesOf('Tables', module) - .add('table.table', () => ` - +const stories = storiesOf('Tables', module); +stories.addDecorator(withKnobs); + +stories.add('table', () => { + const selectedClass = select('class', { + 'table is-bordered': 'table is-bordered', + 'table is-bordered is-centered': 'table is-bordered is-centered', + }, 'table is-bordered'); + + return `
@@ -22,49 +32,5 @@ storiesOf('Tables', module) -
TableThou hast had a good night
`) - .add('table.table.is-bordered', () => ` - - - - - - - - - - - - - - - - - - - - -
TableTable.is-borderedTable.is-centered
Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
`) - .add('table.table.is-bordered.is-centered', () => ` - - - - - - - - - - - - - - - - - - - - -
TableTable.is-borderedTable.is-centered
Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
Thou hast had a good morningThou hast had a good afternoonThou hast had a good night
- `); + `; +}); diff --git a/package.json b/package.json index aa8e5e8..ed00bb1 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,10 @@ }, "homepage": "https://github.com/BcRikko/NES.css#readme", "devDependencies": { + "@storybook/addon-knobs": "^4.0.11", "@storybook/html": "^4.0.11", - "babel-loader": "^8.0.4", "autoprefixer": "^9.1.5", + "babel-loader": "^8.0.4", "clean-css-cli": "^4.2.1", "eslint": "^5.9.0", "eslint-config-airbnb-base": "^13.1.0", @@ -66,7 +67,10 @@ "git add ./css", "git add" ], - "*.js": ["eslint .", "git add"] + "*.js": [ + "eslint .", + "git add" + ] }, "prettier": { "printWidth": 100