mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
25 lines
548 B
JavaScript
25 lines
548 B
JavaScript
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: '',
|
|
};
|