Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17340 from storybookjs/svelte-cli-template-csf
CLI/Svelte: Revert template stories from svelte-native to CSF
- Loading branch information
Showing
7 changed files
with
109 additions
and
122 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Button from './Button.svelte'; | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
// More on argTypes: https://storybook.js.org/docs/svelte/api/argtypes | ||
export default { | ||
title: 'Example/Button', | ||
component: Button, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
label: { control: 'text' }, | ||
onClick: { action: 'onClick' }, | ||
primary: { control: 'boolean' }, | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['small', 'medium', 'large'], | ||
}, | ||
}, | ||
}; | ||
|
||
// More on component templates: https://storybook.js.org/docs/svelte/writing-stories/introduction#using-args | ||
const Template = (args) => ({ | ||
Component: Button, | ||
props: args, | ||
on: { | ||
click: args.onClick, | ||
}, | ||
}); | ||
|
||
// More on args: https://storybook.js.org/docs/svelte/writing-stories/args | ||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
}; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { | ||
label: 'Button', | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: 'large', | ||
label: 'Button', | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: 'small', | ||
label: 'Button', | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Header from './Header.svelte'; | ||
|
||
export default { | ||
title: 'Example/Header', | ||
component: Header, | ||
argTypes: { | ||
onLogin: { action: 'onLogin' }, | ||
onLogout: { action: 'onLogout' }, | ||
onCreateAccount: { action: 'onCreateAccount' }, | ||
}, | ||
}; | ||
|
||
const Template = (args) => ({ | ||
Component: Header, | ||
props: args, | ||
on: { | ||
login: args.onLogin, | ||
logout: args.onLogout, | ||
createAccount: args.onCreateAccount, | ||
}, | ||
}); | ||
|
||
export const LoggedIn = Template.bind({}); | ||
LoggedIn.args = { | ||
user: {}, | ||
}; | ||
|
||
export const LoggedOut = Template.bind({}); | ||
LoggedOut.args = {}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Page from './Page.svelte'; | ||
|
||
export default { | ||
title: 'Example/Page', | ||
component: Page, | ||
argTypes: { | ||
onLogin: { action: 'onLogin' }, | ||
onLogout: { action: 'onLogout' }, | ||
onCreateAccount: { action: 'onCreateAccount' }, | ||
}, | ||
}; | ||
|
||
const Template = (args) => ({ | ||
Component: Page, | ||
props: args, | ||
on: { | ||
login: args.onLogin, | ||
logout: args.onLogout, | ||
createAccount: args.onCreateAccount, | ||
}, | ||
}); | ||
|
||
export const LoggedIn = Template.bind({}); | ||
LoggedIn.args = { | ||
user: {}, | ||
}; | ||
|
||
export const LoggedOut = Template.bind({}); | ||
LoggedOut.args = {}; |
This file was deleted.
Oops, something went wrong.
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