Skip to content

Instantly share code, notes, and snippets.

@nuxlli
Created November 17, 2017 16:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nuxlli/039e32f54d6dbf7397be1eb0606a837d to your computer and use it in GitHub Desktop.
Save nuxlli/039e32f54d6dbf7397be1eb0606a837d to your computer and use it in GitHub Desktop.
Extend material Button with Typescript
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