/** * Taken from https://www.solid-ui.com/docs/components/drawer * Only used in one place hence not a v2 component yet... can be promoted to ui/v2 later */ import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js" import { splitProps } from "solid-js" import type { ContentProps, DescriptionProps, DynamicProps, LabelProps, OverlayProps } from "@corvu/drawer" import DrawerPrimitive from "@corvu/drawer" const Drawer = DrawerPrimitive const DrawerTrigger = DrawerPrimitive.Trigger const DrawerPortal = DrawerPrimitive.Portal const DrawerClose = DrawerPrimitive.Close type DrawerOverlayProps = OverlayProps & { class?: string } const DrawerOverlay = (props: DynamicProps>) => { const [, rest] = splitProps(props as DrawerOverlayProps, ["class"]) const drawerContext = DrawerPrimitive.useContext() const overlayStyle = () => { const state = drawerContext.transitionState() if (state === "opening" || state === "closing") return undefined const open = drawerContext.openPercentage() return { opacity: open, "backdrop-filter": `blur(${4 * open}px)`, } } return ( ) } type DrawerContentProps = ContentProps & { class?: string children?: JSX.Element } const DrawerContent = (props: DynamicProps>) => { const [, rest] = splitProps(props as DrawerContentProps, ["class", "children"]) return ( {props.children} ) } const DrawerHeader: Component> = (props) => { const [, rest] = splitProps(props, ["class"]) return
} const DrawerFooter: Component> = (props) => { const [, rest] = splitProps(props, ["class"]) return
} type DrawerTitleProps = LabelProps & { class?: string } const DrawerTitle = (props: DynamicProps>) => { const [, rest] = splitProps(props as DrawerTitleProps, ["class"]) return ( ) } type DrawerDescriptionProps = DescriptionProps & { class?: string } const DrawerDescription = (props: DynamicProps>) => { const [, rest] = splitProps(props as DrawerDescriptionProps, ["class"]) return ( ) } export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription, }