Skip to content

Instantly share code, notes, and snippets.

@doublejosh
Created May 5, 2020 20:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doublejosh/c8b5caf4cda2369ffdc572e79e8cd4fd to your computer and use it in GitHub Desktop.
Save doublejosh/c8b5caf4cda2369ffdc572e79e8cd4fd to your computer and use it in GitHub Desktop.
Typescript + MUI + Styled
const MyComponent: React.FC<{ theme: MyTheme }> = styled(({ theme, ...props }) => <Box {...props} />)`
&& {
text-align: center;
padding-top: ${props => props.theme.spacing(2)}px;
}
`
export const Wrapper: React.FC<WrapperProps> = ({ ...props }) => {
const theme: MyTheme = useTheme()
return (
<MyComponent theme={theme}>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment