From b4e5fa99ec31b87f77f2351a8d5d2a1fd4367b90 Mon Sep 17 00:00:00 2001 From: faisolavolut Date: Tue, 18 Mar 2025 09:26:29 +0700 Subject: [PATCH] feat: add Sheet component and notification SVG icons for enhanced UI functionality --- components/ui/sheet.tsx | 164 +++++++++++++++++++++++++++++++++++++ svg/Notification.tsx | 10 +++ svg/NotificationUnread.tsx | 10 +++ 3 files changed, 184 insertions(+) create mode 100644 components/ui/sheet.tsx create mode 100644 svg/Notification.tsx create mode 100644 svg/NotificationUnread.tsx diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx new file mode 100644 index 0000000..8b0f5b0 --- /dev/null +++ b/components/ui/sheet.tsx @@ -0,0 +1,164 @@ +"use client"; + +import * as React from "react"; +import * as SheetPrimitive from "@radix-ui/react-dialog"; +import { cva, type VariantProps } from "class-variance-authority"; +import { X } from "lucide-react"; + +import { cn } from "@/lib/utils"; + +const Sheet = SheetPrimitive.Root; + +const SheetTrigger = SheetPrimitive.Trigger; + +const SheetClose = SheetPrimitive.Close; + +const SheetPortal = SheetPrimitive.Portal; + +const SheetOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName; + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + } +); + +interface SheetContentProps + extends React.ComponentPropsWithoutRef, + VariantProps {} + +const SheetContent = React.forwardRef< + React.ElementRef, + SheetContentProps +>(({ side = "right", className, children, ...props }, ref) => ( + + + + + + Close + + {children} + + +)); +SheetContent.displayName = SheetPrimitive.Content.displayName; + +const SheetHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+); +SheetHeader.displayName = "SheetHeader"; + +const SheetFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+); +SheetFooter.displayName = "SheetFooter"; + +const SheetTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +SheetTitle.displayName = SheetPrimitive.Title.displayName; + +const SheetDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +export interface SheetBetterProps { + open?: boolean; +} + +const SheetBetter = ({ + className, + ...props +}: SheetBetterProps & React.HTMLAttributes) => { + return ( + + Open + + + Are you absolutely sure? + + This action cannot be undone. This will permanently delete your + account and remove your data from our servers. + + + + + ); +}; +SheetDescription.displayName = SheetPrimitive.Description.displayName; + +export { + Sheet, + SheetBetter, + SheetPortal, + SheetOverlay, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +}; diff --git a/svg/Notification.tsx b/svg/Notification.tsx new file mode 100644 index 0000000..1364178 --- /dev/null +++ b/svg/Notification.tsx @@ -0,0 +1,10 @@ +import { SVGProps } from "react"; +const SvgComponent = (props: SVGProps) => ( + + + +); +export { SvgComponent as Notification }; diff --git a/svg/NotificationUnread.tsx b/svg/NotificationUnread.tsx new file mode 100644 index 0000000..07fd0d8 --- /dev/null +++ b/svg/NotificationUnread.tsx @@ -0,0 +1,10 @@ +import { SVGProps } from "react"; +const SvgComponent = (props: SVGProps) => ( + + + +); +export { SvgComponent as NotificationUnread };