-
-
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.
Merge pull request #1278 from storybooks/addon-notes-vue
Add support for vue in addon-notes
- Loading branch information
Showing
12 changed files
with
127 additions
and
73 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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import deprecate from 'util-deprecate'; | ||
import addons from '@storybook/addons'; | ||
import { WithNotes as ReactWithNotes } from './react'; | ||
|
||
export class WithNotes extends React.Component { | ||
render() { | ||
const { children, notes } = this.props; | ||
const channel = addons.getChannel(); | ||
export const withNotes = ({ notes }) => { | ||
const channel = addons.getChannel(); | ||
|
||
// send the notes to the channel. | ||
return getStory => () => { | ||
// send the notes to the channel before the story is rendered | ||
channel.emit('storybook/notes/add_notes', notes); | ||
// return children elements. | ||
return children; | ||
} | ||
} | ||
|
||
WithNotes.propTypes = { | ||
children: PropTypes.node, | ||
notes: PropTypes.string, | ||
}; | ||
WithNotes.defaultProps = { | ||
children: null, | ||
notes: '', | ||
return getStory(); | ||
}; | ||
}; | ||
|
||
Object.defineProperty(exports, 'WithNotes', { | ||
configurable: true, | ||
enumerable: true, | ||
get: deprecate( | ||
() => ReactWithNotes, | ||
'@storybook/addon-notes WithNotes Component is deprecated, use withNotes() instead. See https://github.com/storybooks/storybook/tree/master/addons/notes' | ||
), | ||
}); |
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,24 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import addons from '@storybook/addons'; | ||
|
||
export class WithNotes extends React.Component { | ||
render() { | ||
const { children, notes } = this.props; | ||
const channel = addons.getChannel(); | ||
|
||
// send the notes to the channel. | ||
channel.emit('storybook/notes/add_notes', notes); | ||
// return children elements. | ||
return children; | ||
} | ||
} | ||
|
||
WithNotes.propTypes = { | ||
children: PropTypes.node, | ||
notes: PropTypes.string, | ||
}; | ||
WithNotes.defaultProps = { | ||
children: null, | ||
notes: '', | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-events/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
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,2 +1,4 @@ | ||
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
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