@onesy/style-react
Version:
Onesy CSS in JS styling solution for React
15 lines (14 loc) • 755 B
JavaScript
import React from 'react';
import { classNames } from '@onesy/style';
import style from './style';
// May be TValue or a string as a string value literal
const responses = {};
export default function className(value_) {
let props_ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let className_ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
let options_ = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (!responses[options_.name]) responses[options_.name] = [];
const useStyle = React.useState(() => style(value_, options_, responses[options_.name]))[0];
const values = useStyle(props_);
return values.class && classNames([className_, values.class]) || '';
}