Skip to content

Commit

Permalink
Merge pull request #1623 from jribeiro/info-docgen
Browse files Browse the repository at this point in the history
Add flowtype example again
  • Loading branch information
danielduan authored Aug 18, 2017
2 parents a46d83e + e9d1a5e commit a09e3b5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/cra-kitchen-sink/src/components/FlowTypeButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @flow
import React from 'react';

type PropsType = {
/** The text to be rendered in the button */
label: string,
/** Function to be called when the button is clicked */
onClick?: Function,
/** Boolean representing wether the button is disabled */
disabled?: boolean,
};

/** Flow type button description */
const FlowTypeButton = ({ label, onClick, disabled }: PropsType) =>
<button onClick={onClick} disabled={disabled}>
{label}
</button>;

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

export default FlowTypeButton;
8 changes: 8 additions & 0 deletions examples/cra-kitchen-sink/src/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import App from '../App';
import Logger from './Logger';
import Container from './Container';
import DocgenButton from '../components/DocgenButton';
import FlowTypeButton from '../components/FlowTypeButton';

const EVENTS = {
TEST_EVENT_1: 'test-event-1',
Expand Down Expand Up @@ -167,6 +168,13 @@ storiesOf('AddonInfo.DocgenButton', module).addWithInfo('DocgenButton', 'Some De
<DocgenButton onClick={action('clicked')} label="Docgen Button" />
);

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

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

storiesOf('Some really long story kind description', module)
Expand Down

0 comments on commit a09e3b5

Please sign in to comment.