67 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2024-05-16 21:45:19 -07:00
"use client";
2024-04-18 03:06:51 -04:00
2024-05-16 21:45:19 -07:00
import { Sandbox } from "@/lib/types";
import { Ellipsis, Globe, Lock, Trash2 } from "lucide-react";
2024-04-18 03:06:51 -04:00
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
2024-05-16 21:45:19 -07:00
} from "@/components/ui/dropdown-menu";
2024-04-18 03:06:51 -04:00
export default function ProjectCardDropdown({
sandbox,
onVisibilityChange,
onDelete,
}: {
2024-05-16 21:45:19 -07:00
sandbox: Sandbox;
onVisibilityChange: (sandbox: Sandbox) => void;
onDelete: (sandbox: Sandbox) => void;
}) {
2024-04-18 03:06:51 -04:00
return (
2024-05-16 21:45:19 -07:00
<DropdownMenu modal={false}>
2024-04-18 14:42:47 -04:00
<DropdownMenuTrigger
onClick={(e) => {
2024-05-16 21:45:19 -07:00
e.preventDefault();
e.stopPropagation();
2024-04-18 14:42:47 -04:00
}}
2024-04-27 16:22:35 -04:00
className="h-6 w-6 flex items-center justify-center transition-colors bg-transparent hover:bg-muted-foreground/25 rounded-sm outline-foreground"
2024-04-18 14:42:47 -04:00
>
2024-04-18 03:06:51 -04:00
<Ellipsis className="w-4 h-4" />
</DropdownMenuTrigger>
<DropdownMenuContent className="w-40">
<DropdownMenuItem
onClick={(e) => {
2024-05-16 21:45:19 -07:00
e.stopPropagation();
onVisibilityChange(sandbox);
}}
className="cursor-pointer"
>
{sandbox.visibility === "public" ? (
<>
<Lock className="mr-2 h-4 w-4" />
<span>Make Private</span>
</>
) : (
<>
<Globe className="mr-2 h-4 w-4" />
<span>Make Public</span>
</>
)}
2024-04-18 03:06:51 -04:00
</DropdownMenuItem>
<DropdownMenuItem
onClick={(e) => {
2024-05-16 21:45:19 -07:00
e.stopPropagation();
onDelete(sandbox);
}}
className="!text-destructive cursor-pointer"
>
2024-04-18 03:06:51 -04:00
<Trash2 className="mr-2 h-4 w-4" />
<span>Delete Project</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
2024-05-16 21:45:19 -07:00
);
2024-04-18 03:06:51 -04:00
}