forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: setup storybook, add stories for range
- Loading branch information
1 parent
833dc15
commit 562a820
Showing
11 changed files
with
3,220 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@storybook/addon-knobs/register'; |
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 { configure } from '@storybook/polymer'; | ||
|
||
function loadStories() { | ||
const req = require.context('../packages/storybook', true, /\.stories\.js$/); | ||
req.keys().forEach(filename => req(filename)); | ||
} | ||
|
||
configure(loadStories, module); |
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,16 @@ | ||
const path = require('path'); | ||
const { rules } = require('../scripts/webpack/webpack.common.js'); | ||
|
||
module.exports = ({ config }) => { | ||
config.module.rules.push({ | ||
test: [/\.stories\.js$/, /index\.js$/], | ||
loaders: [require.resolve('@storybook/addon-storysource/loader')], | ||
include: [path.resolve(__dirname, '../packages/storybook')], | ||
enforce: 'pre' | ||
}); | ||
|
||
// tweak babel-loader to transpile dependencies | ||
config.module.rules.push(...rules); | ||
|
||
return config; | ||
}; |
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,13 @@ | ||
import '@aybolit/material/range/abm-range.js'; | ||
import { storiesOf } from '@storybook/polymer'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs'; | ||
import { html } from 'lit-html'; | ||
|
||
storiesOf('abm-range', module) | ||
.addDecorator(withKnobs) | ||
.add('default', () => { | ||
const disabled = boolean('Disabled', false); | ||
return html` | ||
<abm-range .disabled="${disabled}"></abm-range> | ||
`; | ||
}); |
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 '@aybolit/bootstrap/range/abs-range.js'; | ||
import { storiesOf } from '@storybook/polymer'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs'; | ||
import { html } from 'lit-html'; | ||
|
||
storiesOf('abs-range', module) | ||
.addDecorator(withKnobs) | ||
.add('default', () => { | ||
const disabled = boolean('Disabled', false); | ||
return html` | ||
<abs-range .disabled="${disabled}"></abs-range> | ||
`; | ||
}); |
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,35 @@ | ||
import '@aybolit/bulma/range/abu-range.js'; | ||
import { storiesOf } from '@storybook/polymer'; | ||
import { withKnobs, boolean, select } from '@storybook/addon-knobs'; | ||
import { html } from 'lit-html'; | ||
|
||
const COLORS = { | ||
primary: 'primary', | ||
info: 'info', | ||
success: 'success', | ||
warning: 'warning', | ||
danger: 'danger', | ||
none: '' | ||
}; | ||
|
||
const SIZES = { | ||
small: 'small', | ||
medium: 'medium', | ||
large: 'large', | ||
normal: '' | ||
}; | ||
|
||
storiesOf('abu-range', module) | ||
.addDecorator(withKnobs) | ||
.add('default', () => { | ||
const circle = boolean('Circle', false); | ||
const size = select('Type', SIZES, SIZES.normal); | ||
const color = select('Color', COLORS, COLORS.none); | ||
const disabled = boolean('Disabled', false); | ||
return html` | ||
<abu-range | ||
theme="${size} ${color} ${circle ? 'circle' : ''}" | ||
.disabled="${disabled}" | ||
></abu-range> | ||
`; | ||
}); |
Empty file.
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,20 @@ | ||
{ | ||
"name": "@aybolit/storybook", | ||
"private": true, | ||
"version": "0.1.0", | ||
"author": "Serhii Kulykov <[email protected]>", | ||
"license": "MIT", | ||
"main": "index.stories.js", | ||
"dependencies": { | ||
"@aybolit/bootstrap": "^0.0.0", | ||
"@aybolit/bulma": "^0.0.0", | ||
"@aybolit/material": "^0.0.0", | ||
"@storybook/addon-knobs": "^5.0.0-beta.1", | ||
"@storybook/addons": "^5.0.0-beta.1", | ||
"@storybook/polymer": "^5.0.0-beta.1", | ||
"lit-html": "^1.0.0-rc.2" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
} | ||
} |
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,12 @@ | ||
module.exports = { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules\/(?!(@webcomponents\/shadycss|lit-element|lit-html|@aybolit)\/).*/, | ||
options: { | ||
cacheDirectory: true | ||
} | ||
} | ||
] | ||
}; |
Oops, something went wrong.