Created
November 17, 2017 16:01
-
-
Save nuxlli/039e32f54d6dbf7397be1eb0606a837d to your computer and use it in GitHub Desktop.
Extend material Button with Typescript
This file contains hidden or 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
import * as React from 'react'; | |
import { withStyles, WithStyles, StandardProps } from 'material-ui'; | |
import MButton, { ButtonProps, ButtonClassKey } from 'material-ui/Button'; | |
// import { compose } from 'recompose'; | |
let styles = { | |
small: { | |
minWidth: 64, | |
minHeight: 32, | |
} | |
}; | |
type ClassKey = | |
| ButtonClassKey | |
| 'small'; | |
interface Props extends StandardProps< | |
ButtonProps, | |
ClassKey | |
> { | |
small?: Boolean; | |
} | |
class Button extends React.Component<Props & WithStyles<ClassKey>> { | |
render() { | |
return <MButton {...this.props} />; | |
} | |
} | |
export default withStyles(styles)<Props>(Button); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment