UNPKG

@crossed/ui

Version:

A universal & performant styling library for React Native, Next.js & React

27 lines (26 loc) 702 B
import { jsx } from "react/jsx-runtime"; import { composeStyles } from "@crossed/styled"; import { Text } from "../../typography"; import { styles } from "./styles"; import { useContext } from "react"; import { localContext } from "./context"; const SwitchLabel = ({ children, id, ...props }) => { const { value, disabled } = useContext(localContext); return typeof children === "string" ? /* @__PURE__ */ jsx( Text, { id, ...props, style: composeStyles( disabled && styles.disabledOff, disabled && value && styles.disabledOn, props.style ), children } ) : children; }; export { SwitchLabel }; //# sourceMappingURL=Label.js.map