This component implements splitscrean view
interface SidebarProps {
info?: ReactNode
right?: boolean
children?: ReactNode
className?: string
}
info
- static block of text near sidebarright
- side to render sidebar block, by default - leftchildren
- content wich will be rendered to sidebar
<Sidebar info={<StaticContent />} right>
<SidebarContent>
This is sidebar content
</SidebarContent>
</Sidebar>
This component is like Sidebar
the only difference is that this component build on react-portals
so it will be mounted in separate DOM element.
interface PortalSidebarProps<T = any> {
closeOnEsc?: boolean
onClose?: (args?: T) => void
closeOnOverlayClick?: boolean
right?: boolean
children?: NodeT
className?: string
}
closeOnEsc
- Sidebar will be closed onEsc
key presscloseOnOverlayClick
- Sidebar will be closed on overlay clickonClose
- this function will be fired on SidebarCloseright
- side to render sidebar block, by default - leftchildren
- content wich will be rendered to sidebar
const Underlay = styled.div`
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
background-color: ${getColor("primary")};
`
<>
<Underlay>Some text</Underlay>
<PortalSidebar right>
<SidebarContent>
This is sidebar content
<SidebarContent>
</PortalSidebar>
</>