From 181149d49b7b783969a7e40aee208ccd4618da1f Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Sat, 25 Dec 2021 20:43:52 +0300 Subject: [PATCH] onClick fine-tunings Signed-off-by: Alex Andreev --- .../components/+preferences/application.tsx | 4 +++- src/renderer/components/switch/switch.tsx | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/renderer/components/+preferences/application.tsx b/src/renderer/components/+preferences/application.tsx index 25a80d1da5..affce2e44b 100644 --- a/src/renderer/components/+preferences/application.tsx +++ b/src/renderer/components/+preferences/application.tsx @@ -135,7 +135,9 @@ export const Application = observer(() => {
- Automatically start Lens on login + userStore.openAtLogin = v.target.checked}> + Automatically start Lens on login + {/* , HTMLInputElement> { onClick?: () => void; } -export function Switch({ children, ...settings }: Props) { +export function Switch({ children, onClick, ...settings }: Props) { const id = `switch-${Date.now()}`; - const onClick = () => { - if (settings.disabled) { + const onLabelClick = () => { + if (settings.disabled || !onClick) { return; } - settings.onClick?.(); + onClick(); }; return ( -