2023-11-03 11:57:10 +03:00

27 lines
736 B
TypeScript

import { useSidebarContext } from '../context/SidebarContext';
import classNames from 'classnames';
import { Sidebar as FlowbiteSidebar } from 'flowbite-react';
import type { FC, PropsWithChildren } from 'react';
const Sidebar: FC<PropsWithChildren<Record<string, unknown>>> = function ({
children,
}) {
const { isOpenOnSmallScreens: isSidebarOpenOnSmallScreens } =
useSidebarContext();
return (
<div
className={classNames(
'fixed overflow-auto top-0 h-screen z-10 lg:sticky lg:!block',
{
hidden: !isSidebarOpenOnSmallScreens,
},
)}
>
<FlowbiteSidebar>{children}</FlowbiteSidebar>
</div>
);
};
export default Object.assign(Sidebar, { ...FlowbiteSidebar });