Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: sfc_vue stories homogenization #10714

Merged
merged 1 commit into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@ export const Jsx = () => ({
methods: { action: linkTo('clicked') },
});

export const Emoji = () => ({
export const WithSomeEmojiAndAction = () => ({
components: { MyButton },
template:
'<my-button @click="action"><span role="img" aria-label="so cool">😀 😎 👍 💯</span></my-button>',
methods: { action: action('clicked') },
template: '<my-button @click="action">😀 😎 👍 💯</my-button>',
methods: { action: action('This was clicked') },
});

WithSomeEmojiAndAction.story = {
name: 'with some emoji and action',
parameters: { notes: 'My notes on a button with emojis' },
};

export const ButtonWithLinkToAnotherStory = () => ({
components: { MyButton },
template: '<my-button @click="action">Go to Welcome Story</my-button>',
methods: { action: linkTo('Welcome') },
});

ButtonWithLinkToAnotherStory.story = {
name: 'button with link to another story',
};
97 changes: 48 additions & 49 deletions lib/cli/src/generators/SFC_VUE/template-csf/src/stories/Welcome.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="main">
<h1>Welcome to STORYBOOK</h1>
<h1>Welcome to storybook</h1>
<p>
This is a UI component dev environment for your app.
</p>
Expand All @@ -11,8 +11,8 @@
<br />
directory.
<br />
A story is a single state of one or more UI components. You can have as many stories as
you want.
A story is a single state of one or more UI components. You can have as many stories as you
want.
<br />
(Basically a story is like a visual test case.)
</p>
Expand All @@ -31,8 +31,8 @@
<br />
You can also edit those components and see changes right away.
<br />
(Try editing the <code class="code">Button</code> component
located at <code class="code">src/stories/Button.js</code>.)
(Try editing the <code class="code">Button</code> component located at
<code class="code">src/stories/Button.js</code>.)
</p>
<p>
This is just one thing you can do with Storybook.
Expand All @@ -57,64 +57,63 @@
<br />
<code class="code">.storybook/webpack.config.js</code>
<br />
to add webpack
loaders and plugins you are using in this project.
to add webpack loaders and plugins you are using in this project.
</p>
</div>
</template>

<script>
const log = () => console.log('Welcome to storybook!')
const log = () => console.log('Welcome to storybook!');

export default {
name: 'welcome',
export default {
name: 'welcome',

props: {
showApp: {
type: Function,
default: log
}
props: {
showApp: {
type: Function,
default: log,
},
},

methods: {
onClick (event) {
event.preventDefault()
this.showApp()
}
}
}
methods: {
onClick(event) {
event.preventDefault();
this.showApp();
},
},
};
</script>

<style>
.main {
padding: 15px;
line-height: 1.4;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
background-color: #ffffff;
}
.main {
padding: 15px;
line-height: 1.4;
font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;
background-color: #ffffff;
}

.logo {
width: 200px;
}
.logo {
width: 200px;
}

.link {
color: #1474f3;
text-decoration: none;
border-bottom: 1px solid #1474f3;
padding-bottom: 2px;
}
.link {
color: #1474f3;
text-decoration: none;
border-bottom: 1px solid #1474f3;
padding-bottom: 2px;
}

.code {
font-size: 15px;
font-weight: 600;
padding: 2px 5px;
border: 1px solid #eae9e9;
border-radius: 4px;
background-color: #f3f2f2;
color: #3a3a3a;
}
.code {
font-size: 15px;
font-weight: 600;
padding: 2px 5px;
border: 1px solid #eae9e9;
border-radius: 4px;
background-color: #f3f2f2;
color: #3a3a3a;
}

.note {
opacity: 0.5;
}
.note {
opacity: 0.5;
}
</style>
97 changes: 48 additions & 49 deletions lib/cli/src/generators/SFC_VUE/template-mdx/src/stories/Welcome.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="main">
<h1>Welcome to STORYBOOK</h1>
<h1>Welcome to storybook</h1>
<p>
This is a UI component dev environment for your app.
</p>
Expand All @@ -11,8 +11,8 @@
<br />
directory.
<br />
A story is a single state of one or more UI components. You can have as many stories as
you want.
A story is a single state of one or more UI components. You can have as many stories as you
want.
<br />
(Basically a story is like a visual test case.)
</p>
Expand All @@ -31,8 +31,8 @@
<br />
You can also edit those components and see changes right away.
<br />
(Try editing the <code class="code">Button</code> component
located at <code class="code">src/stories/Button.js</code>.)
(Try editing the <code class="code">Button</code> component located at
<code class="code">src/stories/Button.js</code>.)
</p>
<p>
This is just one thing you can do with Storybook.
Expand All @@ -57,64 +57,63 @@
<br />
<code class="code">.storybook/webpack.config.js</code>
<br />
to add webpack
loaders and plugins you are using in this project.
to add webpack loaders and plugins you are using in this project.
</p>
</div>
</template>

<script>
const log = () => console.log('Welcome to storybook!')
const log = () => console.log('Welcome to storybook!');

export default {
name: 'welcome',
export default {
name: 'welcome',

props: {
showApp: {
type: Function,
default: log
}
props: {
showApp: {
type: Function,
default: log,
},
},

methods: {
onClick (event) {
event.preventDefault()
this.showApp()
}
}
}
methods: {
onClick(event) {
event.preventDefault();
this.showApp();
},
},
};
</script>

<style>
.main {
padding: 15px;
line-height: 1.4;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
background-color: #ffffff;
}
.main {
padding: 15px;
line-height: 1.4;
font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;
background-color: #ffffff;
}

.logo {
width: 200px;
}
.logo {
width: 200px;
}

.link {
color: #1474f3;
text-decoration: none;
border-bottom: 1px solid #1474f3;
padding-bottom: 2px;
}
.link {
color: #1474f3;
text-decoration: none;
border-bottom: 1px solid #1474f3;
padding-bottom: 2px;
}

.code {
font-size: 15px;
font-weight: 600;
padding: 2px 5px;
border: 1px solid #eae9e9;
border-radius: 4px;
background-color: #f3f2f2;
color: #3a3a3a;
}
.code {
font-size: 15px;
font-weight: 600;
padding: 2px 5px;
border: 1px solid #eae9e9;
border-radius: 4px;
background-color: #f3f2f2;
color: #3a3a3a;
}

.note {
opacity: 0.5;
}
.note {
opacity: 0.5;
}
</style>