-
-
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.
Add TypedButton example showcasing Flowtype & React Docgen docs
- Loading branch information
1 parent
7d083a1
commit f449e16
Showing
4 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": ["env", "stage-0", "react"], | ||
"plugins": [ | ||
["transform-runtime", { | ||
"polyfill": false, | ||
"regenerator": true | ||
}], | ||
"react-docgen" | ||
] | ||
} |
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 @@ | ||
// @flow | ||
import React from 'react'; | ||
|
||
type PropsType = { | ||
/** Boolean indicating wether the button should render as disabled */ | ||
disabled?: boolean, | ||
/** button label. */ | ||
label: string, | ||
/** onClick handler */ | ||
onClick?: Function, | ||
/** component styles */ | ||
style?: {} | ||
}; | ||
|
||
/** Button component description */ | ||
const TypedButton = ({ disabled, label, style, onClick }: PropsType) => ( | ||
<button disabled={disabled} style={style} onClick={onClick}> | ||
{label} | ||
</button> | ||
); | ||
|
||
TypedButton.defaultProps = { | ||
disabled: false, | ||
onClick: () => {}, | ||
style: {}, | ||
}; | ||
|
||
export default TypedButton; |
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