UNPKG

@brizy/ui

Version:
18 lines (17 loc) 1.11 kB
import { classNames } from "../classNamesFn"; import React, { useCallback } from "react"; import { IconsName } from "../EditorIcon/types"; import { EditorIcon } from "../index"; import { BRZ_PREFIX } from "../constants"; export const LegacySwitch = ({ className, value, theme, onChange }) => { const toggle = useCallback(() => onChange(!value), [onChange, value]); const _className = classNames(className)("control__switch", { "control__switch--on": value, "control__switch--light": theme === "light", }); return (React.createElement("div", { className: _className, onClick: toggle }, React.createElement("span", { className: `${BRZ_PREFIX}-span ${BRZ_PREFIX}-control__switch-arrows` }, React.createElement(EditorIcon, { className: `${BRZ_PREFIX}-control__switch--check`, icon: IconsName.CheckSmallLegacy }), React.createElement(EditorIcon, { className: `${BRZ_PREFIX}-control__switch--un-check`, icon: IconsName.CloseLegacy }), React.createElement("span", { className: `${BRZ_PREFIX}-span ${BRZ_PREFIX}-control__switch--handle` })))); };