import React, { FC, PropsWithChildren, useState } from 'react' import styled from 'styled-components' import { Header, HeaderProps } from './Header' import { Footer } from './Footer' import { Menu } from '../Menu' import { Breakpoint, useBreakpoint } from '../Breakpoint' const StyledSection = styled.section` display: flex; min-height: 100vh; flex-direction: column; ` const StyledHeader = styled(Header)` flex: 0 0 auto; ` const StyledFooter = styled(Footer)` flex: 0 0 auto; ` const StyledMain = styled.main` flex: auto; ` const StyledMainSection = styled.section` flex: auto; display: flex; flex-direction: column; ` const StyledMainWrapper = styled.section<{ $column?: boolean }>` flex: auto; display: flex; flex-direction: ${({ $column }) => $column ? 'column' : 'row'}; ` export const Main: FC> = ({ children, column }) => { return ( <> {children} {children} ) } export const Layout: FC>> = ({ children, ...headerProps }) => { const isSmallScreen = useBreakpoint({ s: true, down: true }) const [displayMenu, setDisplayMenu] = useState(false) const handleClickMenu = () => { if (!isSmallScreen) return setDisplayMenu(s => !s) } const handleCloseMenu = () => { if (!isSmallScreen) return setDisplayMenu(false) } const handleLogout = () => {} return (
{headerProps.showMenu && (!isSmallScreen || displayMenu) ? : null} {children}
) }