diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx new file mode 100644 index 00000000..042864c1 --- /dev/null +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx @@ -0,0 +1,44 @@ +import clsx from "clsx"; +import { useState } from "react"; +import styles from "./_SwitchBox.module.scss"; + +export const _SwitchBox = (props) => { + const [is_hovered, setIsHovered] = useState(false); + const [is_mouse_down, setIsMouseDown] = useState(false); + + const is_pending = (props.variable.state === "pending"); + + const getClassNames = (base_class) => clsx(base_class, { + [styles.is_active]: (props.variable.data === true), + [styles.is_pending]: is_pending, + [styles.is_hovered]: is_hovered, + [styles.is_mouse_down]: is_mouse_down, + }); + + const onMouseEnter = () => setIsHovered(true); + const onMouseLeave = () => setIsHovered(false); + const onMouseDown = () => setIsMouseDown(true); + const onMouseUp = () => setIsMouseDown(false); + + const toggleFunction = () => { + props.toggleFunction(); + }; + + + return ( +
{props.secondary_label}
} + <_SwitchBox {...props} />{t("config_page.device.label_auto_select")}
-{t("config_page.device.label_auto_select")}
-{t("config_page.plugins.no_latest_info")}
-{latest_version_label}
{t("config_page.plugins.using_latest_version")}
-{latest_version_label}
{t("config_page.plugins.available_latest_version")}
<_DownloadButton option={option} downloadStartFunction={downloadStartFunction} /> -{t("config_page.plugins.available_latest_version")}
-