Skip to content

Commit de02930

Browse files
committed
chore(website): add functionality to hide certain tokens from list
1 parent f7b09f4 commit de02930

File tree

1 file changed

+15
-0
lines changed
  • packages/paste-website/src/components/tokens-list

1 file changed

+15
-0
lines changed

packages/paste-website/src/components/tokens-list/index.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const Content: React.FC<React.PropsWithChildren<BoxProps>> = (props) => (
4040
const defaultTheme = "twilio";
4141
const defaultFormat = "css";
4242

43+
const hiddenTokens = { "box-shadows": ["shadow", "shadow-low", "shadow-high", "shadow-card"] };
44+
4345
const getTokenListByTheme = (theme: Themes): Tokens => {
4446
let tokenList: Tokens = TwilioThemeTokens.tokens;
4547

@@ -61,6 +63,19 @@ const getTokenListByTheme = (theme: Themes): Tokens => {
6163
tokenList = TwilioThemeTokens.tokens;
6264
break;
6365
}
66+
67+
// Remove hidden tokens from tokenList
68+
Object.keys(hiddenTokens).forEach((category) => {
69+
const cat = category as keyof typeof hiddenTokens;
70+
hiddenTokens[cat].forEach((token) => {
71+
tokenList[cat].forEach((tokenObj) => {
72+
if (tokenObj.name === token) {
73+
tokenList[cat] = tokenList[cat].filter((item) => item.name !== token);
74+
}
75+
});
76+
});
77+
});
78+
6479
return tokenList;
6580
};
6681

0 commit comments

Comments
 (0)