From d8f6ae4fa95c68ae2816ff0e72b7c8d31cbf39e1 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 29 Dec 2021 15:56:50 +0300 Subject: [PATCH] Add custon onChange event with checked prop Signed-off-by: Alex Andreev --- src/renderer/components/switch/switch.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/switch/switch.tsx b/src/renderer/components/switch/switch.tsx index 3fe05bdd85..a798a38293 100644 --- a/src/renderer/components/switch/switch.tsx +++ b/src/renderer/components/switch/switch.tsx @@ -21,17 +21,18 @@ import styles from "./switch.module.scss"; -import React from "react"; +import React, { ChangeEvent, HTMLProps } from "react"; import { cssNames } from "../../utils"; -interface Props extends React.HTMLProps { +interface Props extends Omit, "onChange"> { + onChange?: (checked: boolean, event: ChangeEvent) => void; } -export function Switch({ children, disabled, ...props }: Props) { +export function Switch({ children, disabled, onChange, ...props }: Props) { return ( ); }