Skip to content

Commit

Permalink
✨ feat(added color palette)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeesoPost committed Sep 27, 2024
1 parent 7853157 commit b613845
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions packages/storybook/src/documentation/color.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@ export const baseColors = tokens["brand"]["frameless"]["color"];
<Meta title="Frameless/Color" />

<ColorPalette>
{Object.entries(baseColors).map(([key, token]) => (
<ColorItem key={key} title={key} colors={[token.value]} />
))}
{Object.entries(baseColors).map(([key, token]) => {

const colorValues = typeof token === 'object' && token !== null
? Object.entries(token).reduce((acc, [shade, colorData]) => {
const value = typeof colorData === 'object' && colorData.value ? colorData.value : colorData;
acc[`${key}-${shade}`] = value;
return acc;
}, {})
: { [key]: typeof token === 'object' && token.value ? token.value : token };

return (
<ColorItem
key={key}
title={key}
colors={colorValues}
/>
);

})}

</ColorPalette>

0 comments on commit b613845

Please sign in to comment.