@zohodesk/components
Version:
In this Package, we Provide Some Basic Components to Build Web App
53 lines • 1.61 kB
JavaScript
import { compileClassNames } from '@zohodesk/utils';
export default function cssJSLogic(_ref) {
let {
props,
style
} = _ref;
let {
customClass,
needAppearance,
isBold,
rounded,
size,
children,
palette,
status
} = props;
let {
customButton = '',
customStatus = '',
customStatusSize = ''
} = customClass;
let paletteLower = palette.toLowerCase();
let statusLower = status.toLowerCase();
let buttonClass = compileClassNames({
[]: !!customButton,
[]: isBold,
[]: !needAppearance,
[]]: needAppearance,
[]: needAppearance && rounded,
[]]: needAppearance && !children,
[]]: needAppearance && children,
[]]: needAppearance && children && rounded,
[]: !!needAppearance && statusLower !== 'none'
});
let loaderParentClass = compileClassNames({
[]: !!customStatusSize,
[]: statusLower === 'loading',
[]]: statusLower === 'loading',
[]: statusLower != 'loading'
});
let loaderChildClass = compileClassNames({
[]: !!customStatus,
[]: statusLower === 'loading',
[]]: statusLower === 'loading',
[]: statusLower != 'loading',
[]]: statusLower != 'loading'
});
return {
buttonClass,
loaderParentClass,
loaderChildClass
};
}