Skip to content

Commit

Permalink
docgen info works without flow
Browse files Browse the repository at this point in the history
  • Loading branch information
danielduan committed Aug 7, 2017
1 parent 1b3be20 commit b45a5b2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion addons/info/src/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const renderDocgenPropType = propType => {
return propType.value;
case 'union':
return propType.raw;
case 'signature':
case 'signature':
return propType.raw;
default:
return name;
Expand Down
28 changes: 0 additions & 28 deletions examples/cra-kitchen-sink/src/TypedButton.js

This file was deleted.

27 changes: 27 additions & 0 deletions examples/cra-kitchen-sink/src/components/DocgenButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';

/** Button component description */
const DocgenButton = ({ disabled, label, style, onClick }) =>
<button disabled={disabled} style={style} onClick={onClick}>
{label}
</button>;

DocgenButton.defaultProps = {
disabled: false,
onClick: () => {},
style: {},
};

DocgenButton.propTypes = {
/** Boolean indicating whether the button should render as disabled */
disabled: PropTypes.bool,
/** button label. */
label: PropTypes.string.isRequired,
/** onClick handler */
onClick: PropTypes.func,
/** component styles */
style: PropTypes.shape,
};

export default DocgenButton;
13 changes: 4 additions & 9 deletions examples/cra-kitchen-sink/src/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Button, Welcome } from '@storybook/react/demo';
import App from '../App';
import Logger from './Logger';
import Container from './Container';
import TypedButton from '../TypedButton';
import DocgenButton from '../components/DocgenButton';

const EVENTS = {
TEST_EVENT_1: 'test-event-1',
Expand Down Expand Up @@ -146,14 +146,9 @@ storiesOf('Button', module)
)
);

storiesOf('TypedButton', module)
.addWithInfo('TypedButton',
'Some Description',
() => <TypedButton
onClick={action('clicked')}
label="Typed Button"
/>,
)
storiesOf('AddonInfo.DocgenButton', module).addWithInfo('DocgenButton', 'Some Description', () =>
<DocgenButton onClick={action('clicked')} label="Docgen Button" />
);

storiesOf('App', module).add('full app', () => <App />);

Expand Down

0 comments on commit b45a5b2

Please sign in to comment.