Files
Pien-Studio/apps/web/components/editor/canvas-context-menu.tsx
T

61 lines
1.3 KiB
TypeScript
Raw Normal View History

2026-05-10 03:06:54 +07:00
import React from "react";
import { hoverSubtleClass } from "../../lib/theme";
type CanvasContextMenuProps = {
isDark: boolean;
x: number;
y: number;
labels: {
copy: string;
cut: string;
paste: string;
};
onCopy: () => void;
onCut: () => void;
onPaste: () => void;
};
2026-05-31 03:03:49 +07:00
export function CanvasContextMenu({
isDark,
x,
y,
labels,
onCopy,
onCut,
onPaste,
}: CanvasContextMenuProps) {
2026-05-10 03:06:54 +07:00
return (
<div
className={`absolute z-40 min-w-[160px] rounded border p-1 text-[12px] shadow-2xl ${
2026-05-31 03:03:49 +07:00
isDark
? "border-white/10 bg-[#2a2c31] text-[#e2e5ea]"
: "border-black/10 bg-white text-[#1f2430]"
2026-05-10 03:06:54 +07:00
}`}
style={{ left: x, top: y }}
onClick={(event) => event.stopPropagation()}
>
2026-05-31 03:03:49 +07:00
<button
type="button"
onClick={onCopy}
className={`w-full rounded px-2 py-1 text-left ${hoverSubtleClass(isDark)}`}
>
2026-05-10 03:06:54 +07:00
{labels.copy}
</button>
2026-05-31 03:03:49 +07:00
<button
type="button"
onClick={onCut}
className={`w-full rounded px-2 py-1 text-left ${hoverSubtleClass(isDark)}`}
>
2026-05-10 03:06:54 +07:00
{labels.cut}
</button>
2026-05-31 03:03:49 +07:00
<button
type="button"
onClick={onPaste}
className={`w-full rounded px-2 py-1 text-left ${hoverSubtleClass(isDark)}`}
>
2026-05-10 03:06:54 +07:00
{labels.paste}
</button>
</div>
);
}