From 508a5db62f12b508700f3ff05de9f91d6749112f Mon Sep 17 00:00:00 2001 From: Ryukemeister Date: Mon, 30 Oct 2023 22:55:39 +0530 Subject: [PATCH] add controls component for dropdown and toaster --- .../components/controls/index.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 packages/atoms/availability-list/components/controls/index.tsx diff --git a/packages/atoms/availability-list/components/controls/index.tsx b/packages/atoms/availability-list/components/controls/index.tsx new file mode 100644 index 0000000000..69c8a79b48 --- /dev/null +++ b/packages/atoms/availability-list/components/controls/index.tsx @@ -0,0 +1,60 @@ +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuItem, +} from "@/components/ui/dropdown-menu"; +import { Toaster } from "@/components/ui/toaster"; +import type { Schedule } from "availability-list"; +import { MoreHorizontal, Star, Copy, Trash } from "lucide-react"; + +type ControlsProps = { + schedule: Schedule; + handleDelete: () => void; + handleDuplicate: () => void; + handleSetDefault: () => void; +}; + +export function Controls({ schedule, handleDelete, handleDuplicate, handleSetDefault }: ControlsProps) { + return ( + <> + + + + + + {!schedule.isDefault && ( + { + handleSetDefault(); + }} + className="min-w-40 focus:ring-mute min-w-40 focus:ring-muted"> + + Set as default + + )} + { + handleDuplicate(); + }}> + + Duplicate + + { + handleDelete(); + }}> + + Delete + + + + + + ); +}