67 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-10-21 13:57:45 -06:00
"use client"
2024-04-18 03:06:51 -04:00
2024-10-21 13:57:45 -06: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-10-21 13:57:45 -06:00
} from "@/components/ui/dropdown-menu"
2024-04-18 03:06:51 -04:00
export default function ProjectCardDropdown({
2024-11-11 22:02:34 +01:00
visibility,
onVisibilityChange,
onDelete,
}: {
2024-11-11 22:02:34 +01:00
visibility: Sandbox["visibility"]
onVisibilityChange: () => void
onDelete: () => 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-10-21 13:57:45 -06:00
e.preventDefault()
e.stopPropagation()
2024-04-18 14:42:47 -04:00
}}
className="h-6 w-6 z-10 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-10-21 13:57:45 -06:00
e.stopPropagation()
2024-11-11 22:02:34 +01:00
onVisibilityChange()
}}
className="cursor-pointer"
>
2024-11-11 22:02:34 +01:00
{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-10-21 13:57:45 -06:00
e.stopPropagation()
2024-11-11 22:02:34 +01:00
onDelete()
}}
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-10-21 13:57:45 -06:00
)
2024-04-18 03:06:51 -04:00
}