Skip to content
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

Update token components' APIs #1998

Merged
merged 8 commits into from
Mar 29, 2022
Merged

Update token components' APIs #1998

merged 8 commits into from
Mar 29, 2022

Conversation

mperrotti
Copy link
Contributor

Summary of changes:

  • Add 'xlarge' size option to eventually replace 'extralarge' to align with our size naming ADR
  • Update docs to instruct people not to use an Octicon as a leadingVisual in small tokens because it's rendered <16px
  • Update docs to instruct people not to use an AvatarToken as a small or medium token because it's rendered smaller than our smallest avatar size
  • Add hideRemoveButton prop to AvatarToken

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • [n/a] Tested in Chrome
  • [n/a] Tested in Firefox
  • [n/a] Tested in Safari
  • [n/a] Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@mperrotti mperrotti requested review from a team and rezrah March 24, 2022 20:44
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'extralarge'
// TODO: remove invalid "extralarge" size name in next breaking change
// ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'extralarge' | 'xlarge'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding a @deprecated flag to the extralarge value here?

We'd need to bump to minor instead, but feels like we can give early notice that we'll remove it more formally later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add the @deprecated flag to specific values?

Copy link
Contributor

@rezrah rezrah Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not supported end-to-end yet, but you can get it working for anyone browsing the codebase by hoisting it into a separate type and then reapplying it in the union or as an intersection. Maybe someone will find it useful 🤷

E.g. something like:

Suggested change
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'extralarge' | 'xlarge'
/** @deprecated to be removed in v36.. probably **/
type ExtraLarge = 'extralarge'
export type TokenSizeKeys =
| 'small'
| 'medium'
| 'large'
| 'xlarge'
| ExtraLarge

will show this..
Screenshot 2022-03-29 at 14 29 53

Copy link
Contributor

@rezrah rezrah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Love how you've avoided the breaking change here 🙌

@@ -239,7 +240,8 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
small: 'small',
medium: 'small',
large: 'medium',
extralarge: 'medium'
extralarge: 'medium',
xlarge: 'medium' // will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
Copy link
Contributor

@rezrah rezrah Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this adr is on a private repo, can we remove the url?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this link is helpful for maintainers. I think it's okay that's internal-only

@changeset-bot
Copy link

changeset-bot bot commented Mar 29, 2022

🦋 Changeset detected

Latest commit: 931d73b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 29, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 65.72 KB (+0.04% 🔺)
dist/browser.umd.js 66.11 KB (+0.06% 🔺)

@mperrotti mperrotti temporarily deployed to visual-testing March 29, 2022 21:20 Inactive
@mperrotti mperrotti merged commit cd8a5bb into main Mar 29, 2022
@mperrotti mperrotti deleted the mp/token-api-updates branch March 29, 2022 22:00
@primer-css primer-css mentioned this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants