patternfly-org icon indicating copy to clipboard operation
patternfly-org copied to clipboard

docs(tokens) Updates migration instructions.

Open edonehoo opened this issue 1 year ago • 6 comments
trafficstars

Closes #4218, adds to existing tokens docs

edonehoo avatar Sep 05 '24 19:09 edonehoo

Preview: https://patternfly-org-pr-4239-site.surge.sh

patternfly-build avatar Sep 05 '24 19:09 patternfly-build

@srambach RE https://github.com/patternfly/patternfly-org/issues/4218, were you thinking of a different direction than this pr goes? Much of the info from the linked doc in the issue was already on the site, but do you think it would make more sense in a different page or with more detail? Added some more details and specifics, though!

I saw the codemods notes in the original doc, but they seemed like observations more than things we want to communicate on org

edonehoo avatar Sep 05 '24 20:09 edonehoo

I think this came out of a recent conversation specifically about React tokens (which are the React version of our CSS variables). This includes more than just token variables. This is great info, and I like the improvements you've made to the "develop with tokens" page. But I think this was intended to add some information to the upgrade guide about finding and fixing React tokens specifically. @nicolethoen @wise-king-sullyman maybe you two have more specific information?

srambach avatar Sep 19 '24 14:09 srambach

Following on what Sarah has written about React tokens - we just discussed that on a working session, and it would be great to add some notes like this:

  • React token names are based on the CSS variable names, but instead of -- symbol, _ is used plus the starting --pf- is removed. So for example --pf-t--global--spacer--sm becomes a t_global_spacer_sm react token.
  • React token can be imported from its file directly: import t_global_spacer_sm from '@patternfly/react-tokens/dist/esm/t_global_spacer_sm' or from the whole package: import { t_global_spacer_sm } from '@patternfly/react-tokens'
  • React token is an object having name, value and var properties:
const t_global_spacer_sm = {
  "name": "--pf-t--global--spacer--sm",
  "value": "0.5rem",
  "var": "var(--pf-t--global--spacer--sm)"
}

adamviktora avatar Sep 24 '24 16:09 adamviktora

@adamviktora Is this a blocker or could it be done in a follow up?

kmcfaul avatar Sep 24 '24 19:09 kmcfaul

@kmcfaul It can be a follow up for sure

adamviktora avatar Sep 25 '24 09:09 adamviktora

@kmcfaul I think @adamviktora 's suggestions are the core of this issue so I think it's worth doing before merging this rather than making another issue.

srambach avatar Sep 26 '24 19:09 srambach

@adamviktora ty for this context! @srambach I integrated Adam's comment, but I can't tell if it's enough extra context on its own to help guide people that will actually use this info. WDYT?

If we do want to go further in these docs, or if I'm misunderstanding any of these details, it would probably be good to arrange time for a call to help me understand this more deeply (also cc @nicolethoen) !

edonehoo avatar Sep 30 '24 17:09 edonehoo