Skip to content

Commit

Permalink
fixing colors, avoid accessing nox-existing properties
Browse files Browse the repository at this point in the history
  • Loading branch information
rssilva committed Sep 17, 2024
1 parent 5e6410b commit aeab9e7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/design-tokens/docs/components/TokensTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const TokensTable = ({
return (
<Tr key={tokenName}>
{map(row, (cell, index) => {
const column = columnGroups[0][index].name;
const column = columnGroups[0][index]?.name;
return (
<Td key={`${tokenName}${column}`}>
{index === 0 ? (
Expand Down
28 changes: 3 additions & 25 deletions packages/design-tokens/docs/components/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,14 @@ const FONT_SIZE = reduce(
name: "Name",
transform: getTokenNameFromTuple(prefix),
},
{ name: "Pixels", transform: getTokenComment },
{ name: "Weight", transform: getTokenValue },
{ name: "Rems", transform: getTokenValue },
{
name: "Preview",
transform: createPreview({
prefix,
attribute: "fontSize",
prefix: getTokenKey(fontWeightTokens),
attribute: "fontWeight",
children: TEXT_PREVIEW,
componentProps: {
p: "space40",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
overflow: "hidden",
maxWidth: "600px",
},
}),
},
];
Expand Down Expand Up @@ -262,21 +255,6 @@ export const TOKEN_COLUMNS: TokenColumnsProps = {
}),
},
],
[getTokenKey(fontWeightTokens)]: [
{
name: "Name",
transform: getTokenName(fontWeightTokens),
},
{ name: "Weight", transform: getTokenValue },
{
name: "Preview",
transform: createPreview({
prefix: getTokenKey(fontWeightTokens),
attribute: "fontWeight",
children: TEXT_PREVIEW,
}),
},
],
...SPACE,
...FONT_SIZE,
...COLORS,
Expand Down
2 changes: 1 addition & 1 deletion packages/design-tokens/docs/components/createPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const createPreview =
([tokenName, token]: TokenTuple): JSX.Element => {
const tokenProps = overrideProps[token.value];
const normalizedSuffix = replace(
upperFirst(replace(tokenName, "-", "")),
upperFirst(replace(camelCase(tokenName), "-", "")),
"Negative",
"",
);
Expand Down
2 changes: 1 addition & 1 deletion packages/design-tokens/docs/utils/getTokenNameFromTuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ type TransformFn = (tuple: TokenTuple) => string;
export const getTokenNameFromTuple =
(prefix: string): TransformFn =>
([tokenName]: TokenTuple) => {
return `${camelCase(prefix)}${upperFirst(replace(tokenName, "-", ""))}`;
return `${camelCase(prefix)}${upperFirst(replace(camelCase(tokenName), "-", ""))}`;
};

0 comments on commit aeab9e7

Please sign in to comment.