1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-24 19:42:51 +01:00
developer-roadmap/components/roadmap/content-drawer.tsx

55 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-12-04 16:04:31 +01:00
import { Box, CloseButton } from '@chakra-ui/react';
import { RemoveScroll } from 'react-remove-scroll';
import { RoadmapType } from '../../lib/roadmap';
import RoadmapGroup from '../../pages/[roadmap]/[group]';
type ContentDrawerProps = {
roadmap: RoadmapType;
groupId: string;
onClose?: () => void;
};
export function ContentDrawer(props: ContentDrawerProps) {
const { roadmap, groupId, onClose = () => null } = props;
if (!groupId) {
return null;
}
return (
2021-12-04 19:53:01 +01:00
<Box zIndex={99999} pos="relative">
2021-12-04 16:04:31 +01:00
<Box
onClick={onClose}
pos="fixed"
top={0}
left={0}
right={0}
bottom={0}
bg="black"
opacity={0.4}
/>
<RemoveScroll allowPinchZoom>
2021-12-04 16:04:31 +01:00
<Box
p="0px 30px 30px"
position="fixed"
2021-12-05 00:44:17 +01:00
w={['100%', '60%', '40%']}
2021-12-04 16:04:31 +01:00
bg="white"
top={0}
right={0}
bottom={0}
borderLeftWidth={'1px'}
overflowY="scroll"
>
<CloseButton
onClick={onClose}
pos="absolute"
top={'20px'}
right={'20px'}
zIndex={1}
/>
<RoadmapGroup isOutlet roadmap={roadmap} group={groupId} />
</Box>
</RemoveScroll>
</Box>
);
}