From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001
From: kj_sh604
Date: Sun, 15 Mar 2026 16:19:35 -0400
Subject: refactor: packages/

---
 packages/excalidraw/components/LockButton.tsx | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 packages/excalidraw/components/LockButton.tsx

(limited to 'packages/excalidraw/components/LockButton.tsx')

diff --git a/packages/excalidraw/components/LockButton.tsx b/packages/excalidraw/components/LockButton.tsx
new file mode 100644
index 0000000..f7913d1
--- /dev/null
+++ b/packages/excalidraw/components/LockButton.tsx
@@ -0,0 +1,48 @@
+import "./ToolIcon.scss";
+
+import clsx from "clsx";
+import type { ToolButtonSize } from "./ToolButton";
+import { LockedIcon, UnlockedIcon } from "./icons";
+
+type LockIconProps = {
+  title?: string;
+  name?: string;
+  checked: boolean;
+  onChange?(): void;
+  isMobile?: boolean;
+};
+
+const DEFAULT_SIZE: ToolButtonSize = "medium";
+
+const ICONS = {
+  CHECKED: LockedIcon,
+  UNCHECKED: UnlockedIcon,
+};
+
+export const LockButton = (props: LockIconProps) => {
+  return (
+    <label
+      className={clsx(
+        "ToolIcon ToolIcon__lock",
+        `ToolIcon_size_${DEFAULT_SIZE}`,
+        {
+          "is-mobile": props.isMobile,
+        },
+      )}
+      title={`${props.title} — Q`}
+    >
+      <input
+        className="ToolIcon_type_checkbox"
+        type="checkbox"
+        name={props.name}
+        onChange={props.onChange}
+        checked={props.checked}
+        aria-label={props.title}
+        data-testid="toolbar-lock"
+      />
+      <div className="ToolIcon__icon">
+        {props.checked ? ICONS.CHECKED : ICONS.UNCHECKED}
+      </div>
+    </label>
+  );
+};
-- 
cgit v1.2.3

