Skip to content

Commit

Permalink
Updated storybook configs, updated addons packages
Browse files Browse the repository at this point in the history
  • Loading branch information
szafran89 committed Jun 18, 2020
1 parent 2961fdf commit 310a29d
Show file tree
Hide file tree
Showing 13 changed files with 1,929 additions and 885 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
/index.js
!/.storybook
.storybook/*
src/atoms/icon/templates/*
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
>=10.0.0 <=11.1.0
>=12.13.0 <13.0.0
4 changes: 0 additions & 4 deletions .storybook/addons.js

This file was deleted.

45 changes: 0 additions & 45 deletions .storybook/config.js

This file was deleted.

12 changes: 12 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');

module.exports = {
stories: ['../src/**/*.stories.@(js|mdx)'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-a11y',
'@storybook/addon-storysource',
'@storybook/addon-knobs',
'@storybook/addon-actions'
]
}
8 changes: 8 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { create } from '@storybook/theming/create';

export default create({
base: 'light',
brandTitle: 'Alpaca UI',
brandImage: 'assets/icons/alpaca.svg',
brandUrl: 'https://github.com/SnowdogApps/alpaca-ui'
})
27 changes: 27 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { addDecorator, addParameters } from '@storybook/vue'

import 'focus-visible'
import 'svgxuse'

import { withA11y } from '@storybook/addon-a11y'
import { withKnobs } from '@storybook/addon-knobs'

// Wrap every story in Alpaca App component
import AApp from '../src/atoms/app/App.vue'

addDecorator(withA11y)
addDecorator(withKnobs)
addDecorator(() => ({
components: { AApp },
template: `
<a-app style="padding: 10px;">
<story />
</a-app>
`
}))

addParameters({
docs: {
iframeHeight: '60px'
}
});
7 changes: 0 additions & 7 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
const path = require('path')

module.exports = ({ config }) => {
config.module.rules.push({
test: /\.vue$/,
loader: 'storybook-addon-vue-info/loader',
enforce: 'post'
})

config.module.rules.push({
test: /\.scss$/,
use: [
Expand All @@ -17,7 +11,6 @@ module.exports = ({ config }) => {
]
})

/* PostCSS Support */
config.module.rules.push({
test: /\.scss$/,
use: [
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
"vue-slider-component": "^3.0.40"
},
"devDependencies": {
"@storybook/addon-a11y": "^5.3.17",
"@storybook/addon-actions": "^5.3.17",
"@storybook/addon-knobs": "^5.3.17",
"@storybook/vue": "^5.3.17",
"@storybook/addon-a11y": "6.0.0-beta.31",
"@storybook/addon-actions": "6.0.0-beta.31",
"@storybook/addon-docs": "6.0.0-beta.31",
"@storybook/addon-knobs": "6.0.0-beta.31",
"@storybook/addon-storysource": "6.0.0-beta.31",
"@storybook/vue": "6.0.0-beta.31",
"@vue/babel-preset-app": "^3.11.0",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-core": "^6.26.3",
Expand Down
2 changes: 2 additions & 0 deletions src/atoms/button/Button.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<button
class="a-btn"
type="button"
v-bind="$attrs"
v-on="$listeners"
>
<!-- @slot Slot for button content -->
<slot />
Expand Down
44 changes: 20 additions & 24 deletions src/atoms/button/Button.stories.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import { storiesOf } from '@storybook/vue'
import { select, text } from '@storybook/addon-knobs'

import generateVueInfoTable from '@utils/helpers/generate-vue-info-table.js'
import getClassKnobsConfig from '@utils/helpers/get-class-knobs-config.js'
import selectorsConfig from './Button.selectors.json'

import AButton from './Button.vue'

const info = `
<p>Check <b>Knobs</b> tab to edit component properties dynamically.</p><br>
${generateVueInfoTable(selectorsConfig, 'BEM modifiers')}
`

const classKnobsConfig = getClassKnobsConfig(selectorsConfig)

storiesOf('Test/Button', module)
.addParameters({ info })
.add('Default', () => ({
components: { AButton },
props: {
classKnobs: {
default: select('BEM Modifier', classKnobsConfig)
},
textKnobs: {
default: text('Text', 'Button text')
}
export default {
title: 'Atoms/Button',
component: AButton
}

export const Default = () => ({
components: { AButton },
props: {
classKnobs: {
default: select('BEM Modifier', classKnobsConfig)
},
template: `
<a-button :class="classKnobs">
{{ textKnobs }}
</a-button>
`
}))
textKnobs: {
default: text('Text', 'Button text')
}
},
template: `
<a-button :class="classKnobs">
{{ textKnobs }}
</a-button>
`
})
3 changes: 3 additions & 0 deletions src/atoms/button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<script>
import AButton from './Button.js'
/**
* Check Knobs tab to edit component properties dynamicaly.
*/
export default {
name: 'AlpacaButton',
mixins: [AButton]
Expand Down
Loading

0 comments on commit 310a29d

Please sign in to comment.