UNPKG

create-next-app-template

Version:

This is a template set up to create Next.js App with fast speed and high performance<br/> The current template is provided in a **page routing** structure.<br/>

25 lines (20 loc) 677 B
import { GradientType } from "../types/piece/GradientType"; const gradientStylesProps = (props?: GradientType) => { if (!props) return {}; if (!props.colors || props.colors.length === 0) return {}; let background; const { type = "linear", colors, degree } = props; if (type === "linear") { background = `linear-gradient(${degree}deg, ${colors .map((c) => `${c.color} ${c.stop ? c.stop + "%" : ""}`) .join(", ")})`; } else if (type === "radial") { background = `radial-gradient(${colors .map((c) => `${c.color} ${c.stop ? c.stop + "%" : ""}`) .join(", ")})`; } return { background, }; }; export { gradientStylesProps };