Skip to content

Commit 78427b8

Browse files
authored
ENG-1635: Change key image setting from checkbox to toggle switch (#1121)
* ENG-1635: Change key image setting from checkbox to toggle switch * ENG-1635: Add readOnly to toggle input to suppress React controlled-input warning
1 parent 84cc227 commit 78427b8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

apps/obsidian/src/components/NodeTypeSettings.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,14 @@ const BooleanField = ({
157157
onChange: (value: boolean) => void;
158158
disabled?: boolean;
159159
}) => (
160-
<input
161-
type="checkbox"
162-
checked={!!value}
163-
onChange={(e) => onChange(e.target.checked)}
164-
disabled={disabled}
165-
/>
160+
<div
161+
className={`checkbox-container ${value ? "is-enabled" : ""}`}
162+
onClick={() => {
163+
if (!disabled) onChange(!value);
164+
}}
165+
>
166+
<input type="checkbox" checked={!!value} disabled={disabled} readOnly />
167+
</div>
166168
);
167169

168170
const TextField = ({

0 commit comments

Comments
 (0)