src/helpers/gradient/index.js
export const buildRuleFromGradient = (options) => {
if (!options) return;
const {colors, direction} = options;
const baseRule = 'linear-gradient(' + direction;
return `${colors.reduce((acc, val) => {
return `${acc}, ${val}`;
}, baseRule)});`;
};
Manual
Reference
Source
Test
