An organized slide-out panel for displaying overlay content
Below you'll find source code for the above overlays and it content
components/overlays/drawer-demo.tsx
import {Drawer,DrawerPanel,DrawerHeader,DrawerContent,IconButton,closeDrawer} from "auera-ui";import { IoClose } from "react-icons/io5";import Drawer_Content from "../example/DrawerContent";const DemoDrawer = () => {return (<Drawer value="drawer-demo"><DrawerPanel><DrawerHeader><h1 className="font-medium text-lg theme-dark:text-white">Notifications</h1><IconButton onClick={closeDrawer} variant="outline"><IoClose /></IconButton></DrawerHeader><DrawerContent><Drawer_Content /></DrawerContent></DrawerPanel></Drawer>);};export default DemoDrawer;
components/overlays/float-drawer.tsx
import {Drawer,DrawerPanel,DrawerHeader,DrawerContent,IconButton,closeDrawer} from "auera-ui";import { IoClose } from "react-icons/io5";import Drawer_Content from "../example/DrawerContent";const FloatDemoDrawer = () => {return (<Drawer value="drawer-demo-float"><DrawerPanel type="float"><DrawerHeader><h1 className="font-medium text-lg theme-dark:text-white">Notifications</h1><IconButton onClick={closeDrawer} variant="outline"><IoClose /></IconButton></DrawerHeader><DrawerContent><Drawer_Content /></DrawerContent></DrawerPanel></Drawer>);};export default FloatDemoDrawer;
components/overlays/left-drawer.tsx
import {Drawer,DrawerPanel,DrawerHeader,DrawerContent,IconButton,closeDrawer} from "auera-ui";import { IoClose } from "react-icons/io5";import Drawer_Content from "../example/DrawerContent";const LeftDrawer = () => {return (<Drawer value="left-drawer-demo"><DrawerPanel position="left"><DrawerHeader><h1 className="font-medium text-lg theme-dark:text-white">Notifications</h1><IconButton onClick={closeDrawer} variant="outline"><IoClose /></IconButton></DrawerHeader><DrawerContent><Drawer_Content /></DrawerContent></DrawerPanel></Drawer>);};export default LeftDrawer;
A list of notifications grouped by timestamp using GroupMap
components/examples/DrawerContent.tsx
import React from "react";import { GroupMap, Box, colors, StatusBadge } from "auera-ui";import { notifications } from "@/data/notification";import { formatTime } from "@/utils/formatTime";const Drawer_Content = () => {return (<GroupMapdata={notifications}className="gap-3"dataMapClass="gap-3"renderItem={(item, index) => (<Boxkey={index}direction="column"className="gap-2 p-4 rounded-xl cursor-pointerborder border-neutral-200 theme-dark:border-neutral-700hover:bg-gradient-to-r hover:from-indigo-50 hover:to-purple-50transition-all duration-300 ease-in-out shadow-mdhover:shadow-lg transform hover:scale-105 mb-2 active:scale-90 drawer-demo-card"><Box fullWidth className="flex justify-between items-center"><p className="font-semibold text-lg text-neutral-800 theme-dark:text-white">{item.title}</p>{!item.seen && (<StatusBadge placement="right-bottom" />)}</Box><span className="text-neutral-600 text-sm theme-dark:text-neutral-500">{item.message}</span></Box>)}groupByKey={(item) => item.timestamp}showKeyOnHeadrenderKey={(key) => (<h1className="font-medium text-md"style={{ color: colors.neutral[500] }}>{formatTime(new Date(key))}</h1>)}/>);};export default Drawer_Content;
preventClose
Type:
boolean
Prevents the drawer component from closing when clicked outside
Default:
falseintensity
Type:
"none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"
Controls the intensity of the drop component backdrop.
Default:
smmode
Type:
"light" | "dark"
Sets the theme mode for the backdrop component.
Default:
systemvalue*
Type:
string
Provides the drawer's value, typically used for managing the active state.
Default:
className
Type:
string
Custom class for the Drawer
Default:
position
Type:
"left" | "right"
The drawer position
Default:
righttype
Type:
"float" | "sticky"
Drawer variant type
Default:
stickymode
Type:
"light" | "dark"
A shared theme mode across other drawer component ('Header','Footer')
Default:
systemshowBorder
Type:
boolean
Adds border-bottom to the component.
Default:
truecenterContent
Type:
boolean
Centers all it content
Default:
falseposition
Type:
"left" | "right"
The drawer position
Default:
righttype
Type:
"float" | "sticky"
Drawer variant type
Default:
stickymode
Type:
"light" | "dark"
A shared theme mode across other drawer component ('Header','Footer')
Default:
system