Changeset View
Changeset View
Standalone View
Standalone View
web/components/button.react.js
// @flow | // @flow | ||||
import classnames from 'classnames'; | import classnames from 'classnames'; | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import css from './button.css'; | import css from './button.css'; | ||||
export type ButtonVariant = | export type ButtonVariant = | ||||
| 'primary' | | 'primary' | ||||
| 'secondary' | | 'secondary' | ||||
| 'success' | | 'success' | ||||
| 'danger' | | 'danger' | ||||
| 'round'; | | 'round'; | ||||
type Props = { | export type ButtonProps = { | ||||
+onClick: (event: SyntheticEvent<HTMLButtonElement>) => mixed, | +onClick: (event: SyntheticEvent<HTMLButtonElement>) => mixed, | ||||
+children: React.Node, | +children: React.Node, | ||||
+variant?: ButtonVariant, | +variant?: ButtonVariant, | ||||
+type?: string, | +type?: string, | ||||
+disabled?: boolean, | +disabled?: boolean, | ||||
+className?: string, | +className?: string, | ||||
}; | }; | ||||
function Button(props: Props): React.Node { | function Button(props: ButtonProps): React.Node { | ||||
const { | const { | ||||
onClick, | onClick, | ||||
children, | children, | ||||
variant = 'primary', | variant = 'primary', | ||||
type, | type, | ||||
disabled = false, | disabled = false, | ||||
className = '', | className = '', | ||||
} = props; | } = props; | ||||
Show All 15 Lines |