Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/ui/components/Drawer/Drawer.tsx
T

68 lines
1.8 KiB
TypeScript

"use client";
/*
* Documentation:
* Drawer — https://app.subframe.com/f023064a5ca0/library?component=Drawer_1e71b2cb-8d72-4e67-b368-8805179e9444
*/
import React from "react";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface ContentProps
extends React.ComponentProps<typeof SubframeCore.Drawer.Content> {
children?: React.ReactNode;
className?: string;
}
const Content = React.forwardRef<HTMLDivElement, ContentProps>(function Content(
{ children, className, ...otherProps }: ContentProps,
ref
) {
return children ? (
<SubframeCore.Drawer.Content asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"flex h-full min-w-[320px] flex-col items-start gap-2 border-l border-solid border-[#e5e5e5] bg-[#ffffff]",
className
)}
ref={ref}
>
{children}
</div>
</SubframeCore.Drawer.Content>
) : null;
});
export interface DrawerRootProps
extends React.ComponentProps<typeof SubframeCore.Drawer.Root> {
children?: React.ReactNode;
open?: boolean;
onOpenChange?: (open: boolean) => void;
className?: string;
}
const DrawerRoot = React.forwardRef<HTMLDivElement, DrawerRootProps>(
function DrawerRoot(
{ children, className, ...otherProps }: DrawerRootProps,
ref
) {
return children ? (
<SubframeCore.Drawer.Root asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"flex h-full w-full flex-col items-end justify-center gap-2 bg-[#00000066]",
className
)}
ref={ref}
>
{children}
</div>
</SubframeCore.Drawer.Root>
) : null;
}
);
export const Drawer = Object.assign(DrawerRoot, {
Content,
});