chore: lint
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
698247adeb
commit
fd308c25cf
|
@ -1,4 +1,4 @@
|
||||||
import MyButton from './Button.vue';
|
import MyButton from './Button.vue'
|
||||||
|
|
||||||
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
||||||
export default {
|
export default {
|
||||||
|
@ -13,7 +13,7 @@ export default {
|
||||||
options: ['small', 'medium', 'large'],
|
options: ['small', 'medium', 'large'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
||||||
const Template = (args) => ({
|
const Template = (args) => ({
|
||||||
|
@ -21,32 +21,32 @@ const Template = (args) => ({
|
||||||
components: { MyButton },
|
components: { MyButton },
|
||||||
// The story's `args` need to be mapped into the template through the `setup()` method
|
// The story's `args` need to be mapped into the template through the `setup()` method
|
||||||
setup() {
|
setup() {
|
||||||
return { args };
|
return { args }
|
||||||
},
|
},
|
||||||
// And then the `args` are bound to your component with `v-bind="args"`
|
// And then the `args` are bound to your component with `v-bind="args"`
|
||||||
template: '<my-button v-bind="args" />',
|
template: '<my-button v-bind="args" />',
|
||||||
});
|
})
|
||||||
|
|
||||||
export const Primary = Template.bind({});
|
export const Primary = Template.bind({})
|
||||||
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
||||||
Primary.args = {
|
Primary.args = {
|
||||||
primary: true,
|
primary: true,
|
||||||
label: 'Button',
|
label: 'Button',
|
||||||
};
|
}
|
||||||
|
|
||||||
export const Secondary = Template.bind({});
|
export const Secondary = Template.bind({})
|
||||||
Secondary.args = {
|
Secondary.args = {
|
||||||
label: 'Button',
|
label: 'Button',
|
||||||
};
|
}
|
||||||
|
|
||||||
export const Large = Template.bind({});
|
export const Large = Template.bind({})
|
||||||
Large.args = {
|
Large.args = {
|
||||||
size: 'large',
|
size: 'large',
|
||||||
label: 'Button',
|
label: 'Button',
|
||||||
};
|
}
|
||||||
|
|
||||||
export const Small = Template.bind({});
|
export const Small = Template.bind({})
|
||||||
Small.args = {
|
Small.args = {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
label: 'Button',
|
label: 'Button',
|
||||||
};
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import './button.css';
|
import './button.css'
|
||||||
import { reactive, computed } from 'vue';
|
import { reactive, computed } from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'my-button',
|
name: 'my-button',
|
||||||
|
@ -21,7 +21,7 @@ export default {
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
validator: function (value) {
|
validator: function (value) {
|
||||||
return ['small', 'medium', 'large'].indexOf(value) !== -1;
|
return ['small', 'medium', 'large'].indexOf(value) !== -1
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
backgroundColor: {
|
backgroundColor: {
|
||||||
|
@ -32,7 +32,7 @@ export default {
|
||||||
emits: ['click'],
|
emits: ['click'],
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
props = reactive(props);
|
props = reactive(props)
|
||||||
return {
|
return {
|
||||||
classes: computed(() => ({
|
classes: computed(() => ({
|
||||||
'storybook-button': true,
|
'storybook-button': true,
|
||||||
|
@ -44,9 +44,9 @@ export default {
|
||||||
backgroundColor: props.backgroundColor,
|
backgroundColor: props.backgroundColor,
|
||||||
})),
|
})),
|
||||||
onClick() {
|
onClick() {
|
||||||
emit('click');
|
emit('click')
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import MyHeader from './Header.vue';
|
import MyHeader from './Header.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Example/Header',
|
title: 'Example/Header',
|
||||||
component: MyHeader,
|
component: MyHeader,
|
||||||
};
|
}
|
||||||
|
|
||||||
const Template = (args) => ({
|
const Template = (args) => ({
|
||||||
// Components used in your story `template` are defined in the `components` object
|
// Components used in your story `template` are defined in the `components` object
|
||||||
|
@ -11,18 +11,18 @@ const Template = (args) => ({
|
||||||
// The story's `args` need to be mapped into the template through the `setup()` method
|
// The story's `args` need to be mapped into the template through the `setup()` method
|
||||||
setup() {
|
setup() {
|
||||||
// Story args can be spread into the returned object
|
// Story args can be spread into the returned object
|
||||||
return { ...args };
|
return { ...args }
|
||||||
},
|
},
|
||||||
// Then, the spread values can be accessed directly in the template
|
// Then, the spread values can be accessed directly in the template
|
||||||
template: '<my-header :user="user" />',
|
template: '<my-header :user="user" />',
|
||||||
});
|
})
|
||||||
|
|
||||||
export const LoggedIn = Template.bind({});
|
export const LoggedIn = Template.bind({})
|
||||||
LoggedIn.args = {
|
LoggedIn.args = {
|
||||||
user: {},
|
user: {},
|
||||||
};
|
}
|
||||||
|
|
||||||
export const LoggedOut = Template.bind({});
|
export const LoggedOut = Template.bind({})
|
||||||
LoggedOut.args = {
|
LoggedOut.args = {
|
||||||
user: null,
|
user: null,
|
||||||
};
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import './header.css';
|
import './header.css'
|
||||||
import MyButton from './Button.vue';
|
import MyButton from './Button.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'my-header',
|
name: 'my-header',
|
||||||
|
@ -45,5 +45,5 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['login', 'logout', 'createAccount'],
|
emits: ['login', 'logout', 'createAccount'],
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import MyPage from './Page.vue';
|
import MyPage from './Page.vue'
|
||||||
import * as HeaderStories from './Header.stories';
|
import * as HeaderStories from './Header.stories'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Example/Page',
|
title: 'Example/Page',
|
||||||
component: MyPage,
|
component: MyPage,
|
||||||
};
|
}
|
||||||
|
|
||||||
const Template = (args) => ({
|
const Template = (args) => ({
|
||||||
// Components used in your story `template` are defined in the `components` object
|
// Components used in your story `template` are defined in the `components` object
|
||||||
|
@ -12,19 +12,19 @@ const Template = (args) => ({
|
||||||
// The story's `args` need to be mapped into the template through the `setup()` method
|
// The story's `args` need to be mapped into the template through the `setup()` method
|
||||||
setup() {
|
setup() {
|
||||||
// Story args can be mapped to keys in the returned object
|
// Story args can be mapped to keys in the returned object
|
||||||
return { user: args.user };
|
return { user: args.user }
|
||||||
},
|
},
|
||||||
// Then, those values can be accessed directly in the template
|
// Then, those values can be accessed directly in the template
|
||||||
template: '<my-page :user="user" />',
|
template: '<my-page :user="user" />',
|
||||||
});
|
})
|
||||||
|
|
||||||
export const LoggedIn = Template.bind({});
|
export const LoggedIn = Template.bind({})
|
||||||
LoggedIn.args = {
|
LoggedIn.args = {
|
||||||
// More on composing args: https://storybook.js.org/docs/vue/writing-stories/args#args-composition
|
// More on composing args: https://storybook.js.org/docs/vue/writing-stories/args#args-composition
|
||||||
...HeaderStories.LoggedIn.args,
|
...HeaderStories.LoggedIn.args,
|
||||||
};
|
}
|
||||||
|
|
||||||
export const LoggedOut = Template.bind({});
|
export const LoggedOut = Template.bind({})
|
||||||
LoggedOut.args = {
|
LoggedOut.args = {
|
||||||
...HeaderStories.LoggedOut.args,
|
...HeaderStories.LoggedOut.args,
|
||||||
};
|
}
|
||||||
|
|
|
@ -59,8 +59,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import './page.css';
|
import './page.css'
|
||||||
import MyHeader from './Header.vue';
|
import MyHeader from './Header.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'my-page',
|
name: 'my-page',
|
||||||
|
@ -74,5 +74,5 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['login', 'logout', 'createAccount'],
|
emits: ['login', 'logout', 'createAccount'],
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Reference in New Issue