Skip to content

Instantly share code, notes, and snippets.

@iamdanthedev
Created March 14, 2018 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdanthedev/4c30ae4c6c416af2e7a14905c7357464 to your computer and use it in GitHub Desktop.
Save iamdanthedev/4c30ae4c6c416af2e7a14905c7357464 to your computer and use it in GitHub Desktop.
Styling material-ui components with not hussle
import React from "react";
import { withStyles } from "material-ui";
import Select, { SelectProps } from "material-ui/Select";
import { MenuItem } from "material-ui/Menu";
type OwnProps = SelectProps & {
options: Array<{ label: string; value: string }>;
}
type Props = OwnProps & {
classes: any;
};
const styles = theme => ({
root: {
fontSize: "0.8rem"
},
selectMenu: {
padding: 0
},
select: {
paddingRight: 20
}
});
export const InlineSelect: React.SFC<Props> = ({ options, ...rest }) => {
return (
<Select {...rest}>
{options.map(option => <MenuItem value={option.value}>{option.label}</MenuItem>)}
</Select>
);
};
export default withStyles(styles)(InlineSelect) as React.SFC<OwnProps>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment