From 6dd16e2c44aa1f57ffa73f3e17a6edcfde0c072c Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 14 Jul 2024 14:22:44 -0400 Subject: [PATCH] chore(docs): token chains by theme in grid --- .../content/tokensTableCategories.js | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/packages/module/patternfly-docs/content/tokensTableCategories.js b/packages/module/patternfly-docs/content/tokensTableCategories.js index 4a7b41e..1e44f13 100644 --- a/packages/module/patternfly-docs/content/tokensTableCategories.js +++ b/packages/module/patternfly-docs/content/tokensTableCategories.js @@ -2,6 +2,8 @@ import React, { useMemo } from 'react'; import { Flex, FlexItem, + Grid, + GridItem, SearchInput, Title, Toolbar, @@ -95,7 +97,7 @@ const showTokenChain = (themeTokenData) => {
@@ -162,7 +164,7 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize - {Object.entries(allTokens).map(([layerName, layerDataObj], rowIndex) => { + {Object.entries(allTokens).map(([layerName, layerDataObj], _rowIndex) => { if (layerName === 'palette') { layerDataObj = { palette: layerDataObj }; } @@ -173,12 +175,12 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize return ( <> {formatThemeText(layerName)} tokens - +
+ {/* Only semantic tokens have description, adjust columns accordingly */} - {/* */} {isSemanticLayer && } @@ -191,6 +193,7 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize if (tokenName === 'default') { return undefined; } else if ( + // Match search value to any token name/value in token chain or to description searchValue !== '' && !( tokenName.toLowerCase().includes(searchTerm) || @@ -236,7 +239,6 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize - {/* */} - ); - })} + + + )}
NameCategoryValueDescription
{tokenName} {categoryName} {themeKeys.map((theme) => { const val = @@ -262,7 +264,7 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize )} {!isColor && (
- {hasValue ? val : '-'} + {hasValue ? val : '--'}
)} @@ -274,24 +276,21 @@ export const TokensTableCategories = ({ tokenJson, formatThemeText = capitalize {hasReferences && isTokenExpanded(tokenName) && (
- - - {themeKeys.map((theme) => { - return ( - - {themesDataObj.hasOwnProperty(theme) && ( - - {showTokenChain(themesDataObj[theme])} - + + + + {themeKeys.map( + (theme) => + themesDataObj.hasOwnProperty(theme) && ( + <> + {formatThemeText(theme)}: + {showTokenChain(themesDataObj[theme])} + + ) )} -