SurfSense/surfsense_web/components/ui/mode-toolbar-button.tsx

20 lines
471 B
TypeScript
Raw Normal View History

2026-02-17 12:47:39 +05:30
"use client";
2026-02-17 12:47:39 +05:30
import { BookOpenIcon, PenLineIcon } from "lucide-react";
import { usePlateState } from "platejs/react";
2026-02-17 12:47:39 +05:30
import { ToolbarButton } from "./toolbar";
export function ModeToolbarButton() {
2026-02-17 12:47:39 +05:30
const [readOnly, setReadOnly] = usePlateState("readOnly");
2026-02-17 12:47:39 +05:30
return (
<ToolbarButton
tooltip={readOnly ? "Click to edit" : "Click to view"}
onClick={() => setReadOnly(!readOnly)}
>
{readOnly ? <BookOpenIcon /> : <PenLineIcon />}
</ToolbarButton>
);
}