@heycar-uikit/core
Version:
The React UI library from HeyCar
35 lines (33 loc) • 1.22 kB
JavaScript
function getGridClassNames(props, styles) {
var classNames = [];
Object.keys(props).forEach(function (name) {
var prop = props[name];
if (!prop)
return;
if (typeof prop !== 'object') {
classNames.push(styles[name + "-" + prop]);
return;
}
Object.keys(prop).forEach(function (breakpoint) {
if (!prop[breakpoint])
return;
if (typeof prop[breakpoint] === 'object') {
var propBreakpointObject_1 = prop[breakpoint];
Object.keys(propBreakpointObject_1).forEach(function (size) {
var value = propBreakpointObject_1[size];
if (!value)
return;
classNames.push(styles[name + "-" + breakpoint + "-" + size + "-" + value]);
});
}
else {
var value = prop[breakpoint];
classNames.push(styles[name + "-" + breakpoint + "-" + value]
? styles[name + "-" + breakpoint + "-" + value]
: '');
}
});
});
return classNames;
}
module.exports = getGridClassNames;