-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Carlos Vega <clmvega@gmail.com>
- Loading branch information
Showing
8 changed files
with
87 additions
and
3 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
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,19 @@ | ||
const mergeDirs = require('merge-dirs').default; | ||
const helpers = require('../../lib/helpers'); | ||
const path = require('path'); | ||
const latestVersion = require('latest-version'); | ||
|
||
module.exports = latestVersion('@storybook/angular').then(version => { | ||
mergeDirs(path.resolve(__dirname, 'template'), '.', 'overwrite'); | ||
|
||
const packageJson = helpers.getPackageJson(); | ||
|
||
packageJson.devDependencies = packageJson.devDependencies || {}; | ||
packageJson.devDependencies['@storybook/angular'] = `^${version}`; | ||
|
||
packageJson.scripts = packageJson.scripts || {}; | ||
packageJson.scripts.storybook = 'start-storybook -p 6006'; | ||
packageJson.scripts['build-storybook'] = 'build-storybook'; | ||
|
||
helpers.writePackageJson(packageJson); | ||
}); |
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,5 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ | ||
|
||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-notes/register'; |
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,9 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ | ||
|
||
import { configure } from '@storybook/angular'; | ||
|
||
function loadStories() { | ||
require('../stories'); | ||
} | ||
|
||
configure(loadStories, module); |
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,42 @@ | ||
import { storiesOf } from '@storybook/angular'; | ||
import { addonNotes } from '@storybook/addon-notes'; | ||
import { action } from '@storybook/addon-actions' | ||
import { linkTo } from '@storybook/addon-links' | ||
|
||
import { Welcome, Button } from '@storybook/angular/demo'; | ||
|
||
storiesOf('Welcome', module) | ||
.add('to Storybook', () => ({ | ||
component: Welcome, | ||
props: {} | ||
})) | ||
|
||
storiesOf('Button', module) | ||
.add('with text', () => ({ | ||
component: Button, | ||
props: { | ||
text: 'Hello Button' | ||
} | ||
})) | ||
.add('with some emoji', addonNotes({ notes: 'My notes on a button with emojis' })(() => ({ | ||
component: Button, | ||
props: { | ||
text: '😀 😎 👍 💯' | ||
} | ||
}))) | ||
.add('with some emoji and action', addonNotes({ notes: 'My notes on a button with emojis' })(() => ({ | ||
component: Button, | ||
props: { | ||
text: '😀 😎 👍 💯', | ||
onClick: action('This was clicked OMG') | ||
} | ||
}))) | ||
|
||
storiesOf('Another Button', module) | ||
.add('button with link to another story', () => ({ | ||
component: Button, | ||
props: { | ||
text: 'Go to Welcome Story', | ||
onClick: linkTo('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
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