UNPKG

@heycar-uikit/core

Version:
35 lines (33 loc) 1.19 kB
function getGridClassNames(props, styles) { const classNames = []; Object.keys(props).forEach(name => { const prop = props[name]; if (!prop) return; if (typeof prop !== 'object') { classNames.push(styles[`${name}-${prop}`]); return; } Object.keys(prop).forEach(breakpoint => { if (!prop[breakpoint]) return; if (typeof prop[breakpoint] === 'object') { const propBreakpointObject = prop[breakpoint]; Object.keys(propBreakpointObject).forEach(size => { const value = propBreakpointObject[size]; if (!value) return; classNames.push(styles[`${name}-${breakpoint}-${size}-${value}`]); }); } else { const value = prop[breakpoint]; classNames.push(styles[`${name}-${breakpoint}-${value}`] ? styles[`${name}-${breakpoint}-${value}`] : ''); } }); }); return classNames; } export { getGridClassNames as default };