mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-22 17:00:40 +02:00
build: decouple package deps and introduce yarn workspaces (#7415)
* feat: decouple package deps and introduce yarn workspaces * update root directory * fix * fix scripts * fix lint * update path in scripts * remove yarn.lock files from packages * ignore workspace * dummy * dummy * remove comment check * revert workflow changes * ignore ws when installing gh actions * remove log * update path * fix * fix typo
This commit is contained in:
38
packages/excalidraw/components/Switch.tsx
Normal file
38
packages/excalidraw/components/Switch.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import clsx from "clsx";
|
||||
|
||||
import "./Switch.scss";
|
||||
|
||||
export type SwitchProps = {
|
||||
name: string;
|
||||
checked: boolean;
|
||||
title?: string;
|
||||
onChange: (value: boolean) => void;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
export const Switch = ({
|
||||
title,
|
||||
name,
|
||||
checked,
|
||||
onChange,
|
||||
disabled = false,
|
||||
}: SwitchProps) => {
|
||||
return (
|
||||
<div className={clsx("Switch", { toggled: checked, disabled })}>
|
||||
<input
|
||||
name={name}
|
||||
id={name}
|
||||
title={title}
|
||||
type="checkbox"
|
||||
checked={checked}
|
||||
disabled={disabled}
|
||||
onChange={() => onChange(!checked)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === " ") {
|
||||
onChange(!checked);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user