Skip to content

Commit

Permalink
Write stories
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalee committed Sep 15, 2020
1 parent cbb0dbf commit 27c4a3f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/stories/Button.stories.js
Expand Up @@ -3,14 +3,14 @@ import MyButton from './Button.vue';
export default {
title: 'Example/Button',
component: MyButton,
argTypes: {
backgroundColor: { control: 'color' },
size: { control: { type: 'select', options: ['small', 'medium', 'large'] } },
},
// argTypes: {
// backgroundColor: { control: 'color' },
// size: { control: { type: 'select', options: ['small', 'medium', 'large'] } },
// },
};

const Template = (args, { argTypes }) => ({
props: Object.keys(argTypes),
const Template = (args) => ({
props: Object.keys(args),
components: { MyButton },
template: '<my-button @onClick="onClick" v-bind="$props" />',
});
Expand All @@ -37,3 +37,17 @@ Small.args = {
size: 'small',
label: 'Button',
};

export const BlackOutline = Template.bind({});
BlackOutline.args = {
label: 'Black Outline Button',
outline: true,
outlineColor: 'black',
};

export const GreenOutline = Template.bind({});
GreenOutline.args = {
label: 'Green Outline Button',
outline: true,
outlineColor: 'green',
};
9 changes: 9 additions & 0 deletions src/stories/Button.vue
Expand Up @@ -27,6 +27,13 @@ export default {
backgroundColor: {
type: String,
},
outline: {
type: Boolean,
default: false,
},
outlineColor: {
type: String,
},
},
computed: {
Expand All @@ -36,11 +43,13 @@ export default {
'storybook-button--primary': this.primary,
'storybook-button--secondary': !this.primary,
[`storybook-button--${this.size}`]: true,
'storybook-button--outline': this.outline,
};
},
style() {
return {
backgroundColor: this.backgroundColor,
borderColor: this.outlineColor,
};
},
},
Expand Down
5 changes: 5 additions & 0 deletions src/stories/button.css
Expand Up @@ -28,3 +28,8 @@
font-size: 16px;
padding: 12px 24px;
}

.storybook-button--outline {
border-width: 1px;
border-style: solid;
}

0 comments on commit 27c4a3f

Please sign in to comment.