-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zuza
committed
Jul 17, 2020
1 parent
93664cc
commit f63fb8a
Showing
1 changed file
with
42 additions
and
45 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 |
---|---|---|
@@ -1,56 +1,53 @@ | ||
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 './Label.selectors.json' | ||
|
||
import ALabel from './Label.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('Atoms/Label', module) | ||
.addParameters({ info }) | ||
.add('Default', () => ({ | ||
components: { ALabel }, | ||
props: { | ||
classKnobs: { | ||
default: select('BEM Modifier', classKnobsConfig) | ||
}, | ||
textKnobs: { | ||
default: text('Text', 'Label') | ||
} | ||
export default { | ||
title: 'Atoms/Label', | ||
component: ALabel | ||
} | ||
|
||
export const Default = () => ({ | ||
components: { ALabel }, | ||
props: { | ||
classKnobs: { | ||
default: select('BEM Modifier', classKnobsConfig) | ||
}, | ||
textKnobs: { | ||
default: text('Text', 'Label') | ||
} | ||
}, | ||
template: ` | ||
<a-label :class="classKnobs"> | ||
{{ textKnobs }} | ||
</a-label> | ||
` | ||
}) | ||
|
||
export const CustomTag = () => ({ | ||
components: { ALabel }, | ||
props: { | ||
classKnobs: { | ||
default: select('BEM Modifier', classKnobsConfig) | ||
}, | ||
template: ` | ||
<a-label :class="classKnobs"> | ||
{{ textKnobs }} | ||
</a-label> | ||
` | ||
})) | ||
.add('Custom tag', () => ({ | ||
components: { ALabel }, | ||
props: { | ||
classKnobs: { | ||
default: select('BEM Modifier', classKnobsConfig) | ||
}, | ||
textKnobs: { | ||
default: text('Text', 'Custom tag label') | ||
}, | ||
tagKnob: { | ||
default: text('Html tag', 'span') | ||
} | ||
textKnobs: { | ||
default: text('Text', 'Custom tag label') | ||
}, | ||
template: ` | ||
<a-label | ||
:tag="tagKnob" | ||
:class="classKnobs" | ||
> | ||
{{ textKnobs }} | ||
</a-label> | ||
` | ||
})) | ||
tagKnob: { | ||
default: text('Html tag', 'span') | ||
} | ||
}, | ||
template: ` | ||
<a-label | ||
:tag="tagKnob" | ||
:class="classKnobs" | ||
> | ||
{{ textKnobs }} | ||
</a-label> | ||
` | ||
}) |