mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
refactor(settings-button): integrate settings dialog state with store
This commit is contained in:
parent
efa16c8b77
commit
83356993e9
@ -9,17 +9,18 @@ import {
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { SettingsIcon } from "lucide-react";
|
import { SettingsIcon } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useSettingsStore } from "@/store/useSettingsStore";
|
||||||
|
|
||||||
interface SettingsButtonProps {
|
interface SettingsButtonProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
onClick: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SettingsButton({
|
export default function SettingsButton({
|
||||||
className,
|
className,
|
||||||
onClick,
|
|
||||||
...props
|
...props
|
||||||
}: SettingsButtonProps) {
|
}: SettingsButtonProps) {
|
||||||
|
const { setDialogOpen } = useSettingsStore();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider delayDuration={0}>
|
<TooltipProvider delayDuration={0}>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@ -27,7 +28,7 @@ export default function SettingsButton({
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className={cn("h-8 w-auto p-2", className)}
|
className={cn("h-8 w-auto p-2", className)}
|
||||||
onClick={onClick}
|
onClick={() => setDialogOpen(true)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<SettingsIcon size={16} aria-hidden="true" />
|
<SettingsIcon size={16} aria-hidden="true" />
|
||||||
|
Loading…
Reference in New Issue
Block a user