-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(generate tokens): prefix tokens with a t_ #11002
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
262 changes: 170 additions & 92 deletions
262
packages/react-charts/src/components/ChartBar/examples/ChartBar.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
packages/react-core/src/components/Skeleton/examples/SkeletonText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import React from 'react'; | ||
import { Skeleton } from '@patternfly/react-core'; | ||
/* eslint-disable camelcase */ | ||
import global_font_size_4xl from '@patternfly/react-tokens/dist/esm/global_font_size_4xl'; | ||
import global_font_size_3xl from '@patternfly/react-tokens/dist/esm/global_font_size_3xl'; | ||
import global_font_size_2xl from '@patternfly/react-tokens/dist/esm/global_font_size_2xl'; | ||
import global_font_size_xl from '@patternfly/react-tokens/dist/esm/global_font_size_xl'; | ||
import global_font_size_lg from '@patternfly/react-tokens/dist/esm/global_font_size_lg'; | ||
import global_font_size_md from '@patternfly/react-tokens/dist/esm/global_font_size_md'; | ||
import global_font_size_sm from '@patternfly/react-tokens/dist/esm/global_font_size_sm'; | ||
import t_global_font_size_4xl from '@patternfly/react-tokens/dist/esm/t_global_font_size_4xl'; | ||
import t_global_font_size_3xl from '@patternfly/react-tokens/dist/esm/t_global_font_size_3xl'; | ||
import t_global_font_size_2xl from '@patternfly/react-tokens/dist/esm/t_global_font_size_2xl'; | ||
import t_global_font_size_xl from '@patternfly/react-tokens/dist/esm/t_global_font_size_xl'; | ||
import t_global_font_size_lg from '@patternfly/react-tokens/dist/esm/t_global_font_size_lg'; | ||
import t_global_font_size_md from '@patternfly/react-tokens/dist/esm/t_global_font_size_md'; | ||
import t_global_font_size_sm from '@patternfly/react-tokens/dist/esm/t_global_font_size_sm'; | ||
|
||
export const SkeletonText: React.FunctionComponent = () => ( | ||
<React.Fragment> | ||
{global_font_size_4xl.name} | ||
{t_global_font_size_4xl.name} | ||
<Skeleton fontSize="4xl" screenreaderText="Loading font size 4xl" /> | ||
<br /> | ||
{global_font_size_3xl.name} | ||
{t_global_font_size_3xl.name} | ||
<Skeleton fontSize="3xl" screenreaderText="Loading font size 3xl" /> | ||
<br /> | ||
{global_font_size_2xl.name} | ||
{t_global_font_size_2xl.name} | ||
<Skeleton fontSize="2xl" screenreaderText="Loading font size 2xl" /> | ||
<br /> | ||
{global_font_size_xl.name} | ||
{t_global_font_size_xl.name} | ||
<Skeleton fontSize="xl" screenreaderText="Loading font size xl" /> | ||
<br /> | ||
{global_font_size_lg.name} | ||
{t_global_font_size_lg.name} | ||
<Skeleton fontSize="lg" screenreaderText="Loading font size lg" /> | ||
<br /> | ||
{global_font_size_md.name} | ||
{t_global_font_size_md.name} | ||
<Skeleton fontSize="md" screenreaderText="Loading font size md" /> | ||
<br /> | ||
{global_font_size_sm.name} | ||
{t_global_font_size_sm.name} | ||
<Skeleton fontSize="sm" screenreaderText="Loading font size sm" /> | ||
</React.Fragment> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why the version has been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I built this branch locally and react-tokens still generates duplicates. The only difference now is one file is prefixed with "t_".
For example:
packages/react-tokens/dist/esm/chart_global_label_Margin.js
packages/react-tokens/dist/esm/t_chart_global_label_margin.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlabrecq the
packages/react-tokens/dist/esm/chart_global_label_Margin.js
is the variable.the
packages/react-tokens/dist/esm/t_chart_global_label_margin.js
is the token.@mcoker can add more context from a css perspective as to why they are named the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dlabrecq. The original bug is because the PF CSS has variables named very similarly like these two -
--pf-v6-chart-global--label--Margin
and--pf-t--chart--global--label--margin
. The react-tokens package parses the PF CSS, finds all of our variables, and creates a react-token for each one with a name based based off of what the CSS variable name is. Most of the PF CSS vars fit into 4 categories:--pf-v6-c-[component]
creates a react token likec_[component]
--pf-v6-l-[layout]
, createsl_[layout]
--pf-v6-chart-[color/global/axis/bar/etc]
, createschart_[color/global/axis/bar/etc]
--pf-t--[color/global/chart/etc]
, creates[color/global/chart/etc]_
So for the vars reference above,
--pf-v6-chart-global--label--Margin
and--pf-t--chart--global--label--margin
, the resulting tokens arechart_global_label_Margin
andchart_global_label_margin
. There are a bunch of ways we could address that, but since the CSS token vars (--pf-t--[...]
) are always prefixed with-t--
, prefixing the react token filename witht_[...]
solves this problem and follows the format of other prefixed vars/tokens in PF (--pf-v6-c
and--pf-v6-l
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. I didn't realize we wanted to expose both tokens and variables in this package