-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-issue-labels
- Loading branch information
Showing
476 changed files
with
1,454 additions
and
1,686 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,22 @@ | ||
{ | ||
"ignore": [ | ||
"addons/links/.storybook/stories.js", | ||
"addons/info/.storybook/config.js", | ||
"lib/cli/generators/METEOR/template/.stories/Welcome.js", | ||
"lib/storyshots/.storybook/config.js", | ||
"addons/actions/.storybook/stories.js", | ||
"addons/graphql/.storybook/stories.js", | ||
"addons/info/.storybook/user/modify_webpack_config.js", | ||
"addons/info/.storybook/webpack.config.js", | ||
"addons/knobs/.storybook/user/modify_webpack_config.js", | ||
"addons/options/.storybook/stories.js", | ||
"lib/cli/generators/METEOR/template/.stories/Button.js", | ||
"lib/cli/generators/METEOR/template/.stories/index.js", | ||
"*.ts" | ||
], | ||
"critics": { | ||
"wc": { | ||
"limit": 500 | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ coverage/ | |
build | ||
packages/examples/automated-* | ||
yarn.lock | ||
/**/LICENSE |
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
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 @@ | ||
import '../register'; |
2 changes: 1 addition & 1 deletion
2
packages/addon-actions/.storybook/config.js → addons/actions/.storybook/config.js
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,2 +1,2 @@ | ||
import * as storybook from '@kadira/storybook'; | ||
import * as storybook from '@storybook/react'; | ||
storybook.configure(() => require('./stories'), module); |
2 changes: 1 addition & 1 deletion
2
packages/addon-actions/.storybook/stories.js → addons/actions/.storybook/stories.js
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
File renamed without changes.
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,56 @@ | ||
# Storybook Addon Actions | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/storybooks/storybook.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/storybooks/storybook) | ||
[![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847) | ||
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) | ||
[![Storybook Slack](https://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/) | ||
|
||
Storybook Addon Actions can be used to display data received by event handlers in [Storybook](https://storybooks.js.org). | ||
|
||
This addon works with Storybook for: | ||
[React](https://github.com/storybooks/storybook/tree/master/app/react) and | ||
[React Native](https://github.com/storybooks/storybook/tree/master/app/react-native). | ||
|
||
![Screenshot](docs/screenshot.png) | ||
|
||
## Getting Started | ||
|
||
You can use this addon without installing it manually. | ||
|
||
Import the `action` function and use it to create actions handlers. When creating action handlers, provide a **name** to make it easier to identify. | ||
|
||
> *Note: Make sure NOT to use reserved words as function names. [issues#29](https://github.com/storybooks/storybook-addon-actions/issues/29#issuecomment-288274794)* | ||
```js | ||
import { storiesOf } from '@storybook/react' | ||
import { action } from '@storybook/addon-actions' | ||
|
||
storiesOf('Button', module) | ||
.add('default view', () => ( | ||
<Button onClick={ action('button-click') }> | ||
Hello World! | ||
</Button> | ||
)) | ||
``` | ||
|
||
## Action Decorators | ||
|
||
If you wish to process action data before sending them over to the logger, you can do it with action decorators. | ||
|
||
`decorateAction` takes an array of decorator functions. Each decorator function is passed an array of arguments, and should return a new arguments array to use. `decorateAction` returns a function that can be used like `action` but will log the modified arguments instead of the original arguments. | ||
|
||
```js | ||
import { action, decorateAction } from '@storybook/addon-actions' | ||
|
||
const firstArgAction = decorateAction([ | ||
args => args.slice(0, 1) | ||
]); | ||
|
||
storiesOf('Button', module) | ||
.add('default view', () => ( | ||
<Button onClick={ firstArgAction('button-click') }> | ||
Hello World! | ||
</Button> | ||
)) | ||
``` |
File renamed without changes
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ions/src/components/ActionLogger/index.js → ...ions/src/components/ActionLogger/index.js
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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/addon-actions/src/index.js → addons/actions/src/index.js
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
2 changes: 1 addition & 1 deletion
2
packages/addon-actions/src/manager.js → addons/actions/src/manager.js
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
2 changes: 1 addition & 1 deletion
2
packages/addon-actions/src/preview.js → addons/actions/src/preview.js
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
File renamed without changes.
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,78 @@ | ||
# Storybook Centered Decorator | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/storybooks/storybook.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/storybooks/storybook) | ||
[![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847) | ||
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) | ||
[![Storybook Slack](https://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/) | ||
|
||
Storybook Centered Decorator can be used to center components inside the preview in [Storybook](https://storybooks.js.org). | ||
|
||
This addon works with Storybook for: | ||
[React](https://github.com/storybooks/storybook/tree/master/app/react). | ||
|
||
### Usage | ||
|
||
```sh | ||
npm i @storybook/addon-centered | ||
``` | ||
|
||
#### As a decorator | ||
You can set the decorator locally: | ||
|
||
```js | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import MyComponent from '../Component'; | ||
import centered from '@storybook/addon-centered'; | ||
|
||
storiesOf('MyComponent', module) | ||
.addDecorator(centered) | ||
.add('without props', () => (<MyComponent />)) | ||
.add('with some props', () => (<MyComponent text="The Comp"/>)); | ||
``` | ||
|
||
Or you can also add this decorator globally: | ||
|
||
```js | ||
import { configure, addDecorator } from '@storybook/react'; | ||
import centered from '@storybook/react-storybook-decorator-centered'; | ||
|
||
addDecorator(centered); | ||
|
||
configure(function () { | ||
//... | ||
}, module); | ||
``` | ||
|
||
#### As an extension | ||
1 - Configure the extension | ||
|
||
```js | ||
import React from 'react'; | ||
import { configure, setAddon } from '@storybook/react'; | ||
import centered from '@storybook/addon-centered'; | ||
|
||
setAddon({ | ||
addCentered(storyName, storyFn) { | ||
this.add(storyName, (context) => ( | ||
centered.call(context, storyFn) | ||
)); | ||
} | ||
}); | ||
|
||
configure(function () { | ||
//... | ||
}, module); | ||
``` | ||
|
||
2 - Use it in your story | ||
|
||
```js | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import Component from '../Component'; | ||
|
||
storiesOf('Component', module) | ||
.addCentered('without props', () => (<Component />)) | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/decorator-centered/package.json → addons/centered/package.json
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
File renamed without changes.
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,7 @@ | ||
// Use the line below to register this addon | ||
// import '@storybook/addon-comments/register'; | ||
import '@storybook/addon-actions/register'; | ||
import '@kadira/storybook-database-cloud/register'; | ||
|
||
import { init } from '../src/manager'; | ||
init(); |
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
File renamed without changes.
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,28 @@ | ||
# Storybook Comments Addon | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/storybooks/storybook.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/storybooks/storybook) | ||
[![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847) | ||
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) | ||
[![Storybook Slack](https://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/) | ||
|
||
Storybook Comments Addon allows you to add comments for your stories in [Storybook](https://storybooks.js.org). | ||
|
||
This addon works with Storybook for: | ||
[React](https://github.com/storybooks/storybook/tree/master/app/react). | ||
|
||
![Screenshot](docs/screenshot.png) | ||
|
||
## Getting Started | ||
|
||
First, install the addon | ||
|
||
```sh | ||
npm install -D @storybook/addon-comments | ||
``` | ||
|
||
Add this line to your `addons.js` file (create this file inside your storybook config directory if needed). | ||
|
||
```js | ||
import '@storybook/addon-comments/register'; | ||
``` |
File renamed without changes
File renamed without changes.
Oops, something went wrong.