UNPKG

@chayns-components/devalue-slider

Version:
29 lines (28 loc) 814 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useThumbIcon = void 0; var _react = require("motion/react"); var _react2 = require("react"); const useThumbIcon = (x, iconColor) => { const [icon, setIcon] = (0, _react2.useState)('fas fa-arrow-right'); const opacity = (0, _react.useTransform)(x, [0, 5, 6, 200], [1, 0, 0, 1]); const styles = (0, _react2.useMemo)(() => ({ opacity, color: iconColor }), [iconColor, opacity]); (0, _react2.useEffect)(() => x.on('change', value => { if (value > 5) { setIcon('fas fa-check'); } else { setIcon('fas fa-arrow-right'); } }), [x]); return (0, _react2.useMemo)(() => ({ icon, styles }), [icon, styles]); }; exports.useThumbIcon = useThumbIcon; //# sourceMappingURL=design.js.map