mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: update design of ImageExportDialog (#6614)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
6459ccda6a
commit
08563e7d7b
21 changed files with 881 additions and 171 deletions
38
src/components/Switch.tsx
Normal file
38
src/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={(e) => {
|
||||
if (e.key === " ") {
|
||||
onChange(!checked);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue