@brizy/ui
Version:
React elements in Brizy style
18 lines (17 loc) • 1.11 kB
JavaScript
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` }))));
};