Last active
March 7, 2022 20:48
-
-
Save martinratinaud/c0b07ad87676c9ce916afb86223fbd24 to your computer and use it in GitHub Desktop.
typescript Dot Notation styled-components
This file contains 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 styled from 'styled-components'; | |
const FullPageLayout = styled<any>(styled.div``)` | |
display: flex; | |
flex-direction: column; | |
`; | |
interface HeaderProps { | |
fixed?: boolean; | |
} | |
const Header = styled<HeaderProps>(({ fixed, ...rest }) => <header {...rest} />)` | |
background-color: red; | |
`; | |
const Main = styled<any>(styled.main``)` | |
background-color: yellow; | |
`; | |
const Footer = styled<any>(styled.footer``)` | |
background-color: green; | |
`; | |
interface FullPageLayoutProps { | |
children: any; | |
} | |
const FullPageLayoutWrapper = ({ children, ...rest }: FullPageLayoutProps) => ( | |
<FullPageLayout {...rest}>{children}</FullPageLayout> | |
); | |
FullPageLayoutWrapper.Header = Header; | |
FullPageLayoutWrapper.Main = Main; | |
FullPageLayoutWrapper.Footer = Footer; | |
export default FullPageLayoutWrapper; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment