UNPKG

vcc-ui

Version:

A React library for building user interfaces at Volvo Cars

24 lines (23 loc) 640 B
import { merge } from '../utils/merge'; /** Makes all sub-style variants inherit from the 'standard' styling for that type scale. */ export const buildTypeScale = typeScale => { return Object.keys(typeScale).reduce((accumTypeScale, typeScaleKey) => { const { standard, ...subStyles } = typeScale[typeScaleKey]; return { ...accumTypeScale, [typeScaleKey]: { standard: standard, ...Object.keys(subStyles).reduce((accumVariants, subStyleKey) => ({ ...accumVariants, [subStyleKey]: merge(standard, subStyles[subStyleKey]) }), {}) } }; }, {}); };