mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
refactor(settings-button): update to use dropdown menu item instead of button
This commit is contained in:
parent
d0235b0989
commit
171ee8abdc
@ -1,41 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "./ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { SettingsIcon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Settings } from "lucide-react";
|
||||
import { useSettingsStore } from "@/store/useSettingsStore";
|
||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
|
||||
interface SettingsButtonProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function SettingsButton({
|
||||
className,
|
||||
...props
|
||||
}: SettingsButtonProps) {
|
||||
export function SettingsButton() {
|
||||
const { setDialogOpen } = useSettingsStore();
|
||||
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className={cn("h-8 w-auto p-2", className)}
|
||||
onClick={() => setDialogOpen(true)}
|
||||
{...props}
|
||||
>
|
||||
<SettingsIcon size={16} aria-hidden="true" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="px-2 py-1 text-xs">Settings</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
<DropdownMenuItem onClick={() => setDialogOpen(true)}>
|
||||
<Settings />
|
||||
Settings
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user