Skip to content

Commit

Permalink
fix: story
Browse files Browse the repository at this point in the history
  • Loading branch information
Niznikr committed Jan 23, 2025
1 parent 177ffa6 commit 441d140
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .changeset/dry-birds-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@launchpad-ui/tokens": patch
"@launchpad-ui/icons": patch
"@launchpad-ui/box": patch
---

Remove `color` prefix from `gradient` tokens
12 changes: 6 additions & 6 deletions packages/tokens/stories/color.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ const TokenTable = ({ tokens }: { tokens: Record<string, string> }) => {
<TooltipTrigger>
<Button
onPress={() => {
navigator.clipboard.writeText(`--lp-color-${key}`);
navigator.clipboard.writeText(
value.substring(value.lastIndexOf('--'), value.lastIndexOf(')')),
);
ToastQueue.success('Copied!');
}}
style={{ font: 'var(--lp-text-code-1-regular)' }}
variant="minimal"
>
{`--lp-color-${key}`}
{value.substring(value.lastIndexOf('--'), value.lastIndexOf(')'))}
</Button>
<Tooltip placement="bottom">Copy to clipboard</Tooltip>
</TooltipTrigger>
Expand All @@ -98,17 +100,15 @@ const TokenTable = ({ tokens }: { tokens: Record<string, string> }) => {
};

const global = Object.keys(vars.color)
.filter((key) =>
['black', 'blue', 'green', 'gray', 'red', 'purple', 'white', 'brand', 'gradient'].includes(key),
)
.filter((key) => !['bg', 'border', 'fill', 'shadow', 'text'].includes(key))
.reduce((obj, key) => {
// @ts-expect-error fixme
obj[key] = vars.color[key];
return obj;
}, {});

export const Global = {
render: () => <TokenTable tokens={flatten(global)} />,
render: () => <TokenTable tokens={{ ...flatten(global), ...vars.gradient }} />,
};

const alias = Object.keys(vars.color)
Expand Down

0 comments on commit 441d140

Please sign in to comment.