File size: 1,548 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | import React, { PropsWithChildren, useCallback, useState } from 'react'
import styled from 'styled-components'
import { Header } from './Header'
import media from '../theming/mediaQueries'
import { MiniNav, FullNav } from './nav'
const Layout = ({ children }: PropsWithChildren<{}>) => {
const [isNavOpen, setIsNavOpen] = useState(false)
const toggleNav = useCallback(() => {
setIsNavOpen(isOpen => !isOpen)
}, [setIsNavOpen])
return (
<>
<Header isNavOpen={isNavOpen} toggleNav={toggleNav} />
<MiniNav />
{isNavOpen && <FullNav />}
<Content>
<InnerContent>{children}</InnerContent>
</Content>
</>
)
}
export default Layout
const Content = styled.div`
margin-top: ${({ theme }) => theme.dimensions.headerHeight}px;
margin-left: ${({ theme }) => theme.dimensions.miniNavWidth}px;
overflow-x: hidden;
.isCapturing & {
background: transparent;
}
${media.tablet`
& {
margin-left: 0;
}
`}
${media.mobile`
& {
margin-left: 0;
}
`}
`
const InnerContent = styled.div`
padding-top: 10px;
background-image: linear-gradient(
-90deg,
${({ theme }) => theme.colors.gradientColor0},
${({ theme }) => theme.colors.gradientColor1}
);
background-size: 100% 150px;
background-repeat: no-repeat;
background-position: top left;
.isCapturing & {
background: transparent;
}
`
|