@fylgja/props-builder
Version:
Effortlessly generate Design Tokens (CSS custom properties) from JavaScript objects.
31 lines (22 loc) • 613 B
JavaScript
// Fylgja (https://fylgja.dev)
// Licensed under MIT Open Source
function formatFigma(key, colorKeys = []) {
if (!key) return;
if (key.includes("size") && !key.includes("border-size")) {
return { type: "sizing" };
}
if (key.includes("border-size")) {
return { type: "borderWidth" };
}
if (key.includes("border-radius") || key.includes("radius")) {
return { type: "borderRadius" };
}
if (key.includes("shadow")) {
return { type: "boxShadow" };
}
if (colorKeys.some((color) => key.includes(color))) {
return { type: "color" };
}
return { type: "other" };
}
export default formatFigma;