forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ember-cli: Update stories to module format
- Loading branch information
Showing
10 changed files
with
150 additions
and
102 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
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,15 +1,22 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
import { checkA11y } from '@storybook/addon-a11y'; | ||
|
||
storiesOf('Addon|a11y', module) | ||
.addDecorator(checkA11y) | ||
.addParameters({ options: { selectedPanel: '@storybook/a11y/panel' } }) | ||
.add('Default', () => hbs`<button></button>`) | ||
.add('Label', () => hbs`<button>Testing the a11y addon</button>`) | ||
.add('Disabled', () => hbs`<button disabled>Testing the a11y addon</button>`) | ||
.add( | ||
'Invalid contrast', | ||
() => | ||
hbs`<button style="color: black; background-color: brown;">Testing the a11y addon</button>` | ||
); | ||
export default { | ||
title: 'Addon|a11y', | ||
decorators: [checkA11y], | ||
|
||
parameters: { | ||
options: { selectedPanel: '@storybook/a11y/panel' }, | ||
}, | ||
}; | ||
|
||
export const Default = () => hbs`<button></button>`; | ||
export const Label = () => hbs`<button>Testing the a11y addon</button>`; | ||
export const Disabled = () => hbs`<button disabled>Testing the a11y addon</button>`; | ||
|
||
export const invalidContrast = () => | ||
hbs`<button style="color: black; background-color: brown;">Testing the a11y addon</button>`; | ||
|
||
invalidContrast.story = { | ||
name: 'Invalid contrast', | ||
}; |
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,16 +1,19 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
storiesOf('Addon|Actions', module) | ||
.addParameters({ | ||
export default { | ||
title: 'Addon|Actions', | ||
|
||
parameters: { | ||
options: { | ||
selectedPanel: 'storybook/actions/panel', | ||
}, | ||
}) | ||
.add('button', () => ({ | ||
template: hbs`<button {{action onClick}}>Click Me</button>`, | ||
context: { | ||
onClick: action('clicked'), | ||
}, | ||
})); | ||
}, | ||
}; | ||
|
||
export const button = () => ({ | ||
template: hbs`<button {{action onClick}}>Click Me</button>`, | ||
context: { | ||
onClick: action('clicked'), | ||
}, | ||
}); |
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,16 +1,28 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
|
||
storiesOf('Addon|Backgrounds', module) | ||
.addParameters({ | ||
export default { | ||
title: 'Addon|Backgrounds', | ||
|
||
parameters: { | ||
backgrounds: [ | ||
{ name: 'light', value: '#eeeeee' }, | ||
{ name: 'dark', value: '#222222', default: true }, | ||
], | ||
}) | ||
.add('story 1', () => ({ | ||
template: hbs`<button>You should be able to switch backgrounds for this story</button>`, | ||
})) | ||
.add('story 2', () => ({ | ||
template: hbs`<button>This one too!</button>`, | ||
})); | ||
}, | ||
}; | ||
|
||
export const story1 = () => ({ | ||
template: hbs`<button>You should be able to switch backgrounds for this story</button>`, | ||
}); | ||
|
||
story1.story = { | ||
name: 'story 1', | ||
}; | ||
|
||
export const story2 = () => ({ | ||
template: hbs`<button>This one too!</button>`, | ||
}); | ||
|
||
story2.story = { | ||
name: 'story 2', | ||
}; |
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,12 +1,15 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
import Centered from '@storybook/addon-centered/ember'; | ||
|
||
storiesOf('Addon|Centered', module) | ||
.addParameters({ | ||
export default { | ||
title: 'Addon|Centered', | ||
decorators: [Centered], | ||
|
||
parameters: { | ||
component: Centered, | ||
}) | ||
.addDecorator(Centered) | ||
.add('button', () => ({ | ||
template: hbs`<button>A Button</button>`, | ||
})); | ||
}, | ||
}; | ||
|
||
export const button = () => ({ | ||
template: hbs`<button>A Button</button>`, | ||
}); |
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
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,10 +1,17 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
storiesOf('Addon|Links', module).add('Go to welcome', () => ({ | ||
export default { | ||
title: 'Addon|Links', | ||
}; | ||
|
||
export const goToWelcome = () => ({ | ||
template: hbs`<button {{action onClick}}>This button brings you to welcome</button>`, | ||
context: { | ||
onClick: linkTo('Welcome'), | ||
}, | ||
})); | ||
}); | ||
|
||
goToWelcome.story = { | ||
name: 'Go to welcome', | ||
}; |
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,26 +1,32 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
|
||
storiesOf('Addon|Notes', module) | ||
.add( | ||
'Simple note', | ||
() => ({ | ||
template: hbs`<p><strong>Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna.</strong></p>`, | ||
}), | ||
{ notes: 'My notes on some bold text' } | ||
) | ||
.add( | ||
'Note with HTML', | ||
() => ({ | ||
template: hbs`<p>🤔😳😯😮<br/>😄😩😓😱<br/>🤓😑😶😊</p>`, | ||
}), | ||
{ | ||
notes: ` | ||
<h2>My notes on emojies</h2> | ||
<em>It's not all that important to be honest, but..</em> | ||
Emojis are great, I love emojis, in fact I like using them in my Component notes too! 😇 | ||
`, | ||
} | ||
); | ||
|
||
export default { | ||
title: 'Addon|Notes', | ||
}; | ||
|
||
export const simpleNote = () => ({ | ||
template: hbs`<p><strong>Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna.</strong></p>`, | ||
}); | ||
|
||
simpleNote.story = { | ||
name: 'Simple note', | ||
parameters: { notes: 'My notes on some bold text' }, | ||
}; | ||
|
||
export const noteWithHtml = () => ({ | ||
template: hbs`<p>🤔😳😯😮<br/>😄😩😓😱<br/>🤓😑😶😊</p>`, | ||
}); | ||
|
||
noteWithHtml.story = { | ||
name: 'Note with HTML', | ||
|
||
parameters: { | ||
notes: ` | ||
<h2>My notes on emojies</h2> | ||
<em>It's not all that important to be honest, but..</em> | ||
Emojis are great, I love emojis, in fact I like using them in my Component notes too! 😇 | ||
`, | ||
}, | ||
}; |
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,10 +1,15 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
|
||
storiesOf('Welcome', module) | ||
.addParameters({ options: { showPanel: false } }) | ||
.add('basic', () => ({ | ||
template: hbs` | ||
export default { | ||
title: 'Welcome', | ||
|
||
parameters: { | ||
options: { showPanel: false }, | ||
}, | ||
}; | ||
|
||
export const basic = () => ({ | ||
template: hbs` | ||
{{welcome-page}} | ||
`, | ||
})); | ||
}); |
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