import { getVarName } from '../helpers'; import { GumParseArray } from '../models'; /** * Generates CSS variables based on array of values, prefix and unti * @param values CSS variable value array * @param prefix CSS variable name prefix * @param unit (optional) determines if the value contains the unit. Leave blank if unitless. */ export const generateArrayValues: GumParseArray = (values, prefix, unit) => { return values.map((value) => { const newValue = `${value}${unit || ''}`; const valueName = value < 0 ? `n${value * -1}` : `${value}${unit || ''}`; return `${getVarName(prefix, valueName)}: ${newValue};`; }); };