-
Notifications
You must be signed in to change notification settings - Fork 577
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
Deprecate legacy Label component #1889
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d21ef4f
moves Label to deprecated bundle
mperrotti 7bcc7b8
graduates Label2 to main bundle
mperrotti ea882de
cleanup
mperrotti e02c828
adds changeset
mperrotti 7b94bb7
fixes tests
mperrotti 15b4322
update legacy label snapshots
mperrotti 81520b1
Update .changeset/heavy-points-marry.md
mperrotti cab0cb5
Update docs/content/Label.mdx
mperrotti bc1d25b
addresses pr feedback
mperrotti 8167b2b
adds Label back to sidebar
mperrotti 705f90d
Merge branch 'next/v35.0.0' of github.com:primer/react into mp/deprec…
mperrotti 8d09179
updates tests, removes docs header image
mperrotti ced30db
removes docs header image
mperrotti 7a57ccf
Merge branch 'next-major' of github.com:primer/react into mp/deprecat…
mperrotti 9252b74
Merge branch 'next-major' of github.com:primer/react into mp/deprecat…
mperrotti e27df7e
Merge branch 'next-major' of github.com:primer/react into mp/deprecat…
mperrotti 6af5cf5
fixes tests
mperrotti 9edff21
Merge branch 'next-major' of github.com:primer/react into mp/deprecat…
mperrotti cf2e973
resets changed test
mperrotti 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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
'@primer/react': major | ||
--- | ||
|
||
The Label component's API and visual design have been updated to be consistent with its counterpart in [Primer ViewComponents' Label component](https://primer.style/view-components/components/label). | ||
|
||
Major changes in the new Label component: | ||
|
||
- No more `medium` size - only `small` and `large` | ||
- Labels are outlined by default, so the `outline` prop has been removed | ||
- Custom text and background colors are discouraged, but still possible via the `sx` prop | ||
|
||
If you were using the `Label` component to render issue/PR labels, use the [IssueLabelToken](https://primer.style/react/Token#issuelabeltoken) component instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {Label} from "@primer/react" | ||
|
||
<Label outline>default</Label> | ||
<Label variant="small" outline sx={{borderColor: 'danger.emphasis', color: 'danger.fg'}}>danger</Label> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {Label} from "@primer/react" | ||
|
||
<Label>default</Label> | ||
<Label size="small" variant="danger">danger</Label> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: Label | ||
description: Use Label components to add contextual metadata to a design. | ||
status: Deprecated | ||
source: https://github.com/primer/react/blob/main/src/Label.tsx | ||
componentId: legacy_label | ||
--- | ||
|
||
## Deprecation | ||
|
||
Use the new [Label](/Label) instead. | ||
|
||
## Example | ||
|
||
```jsx live deprecated | ||
<> | ||
<Label variant="small" outline sx={{borderColor: 'danger.emphasis', mr: 2, color: 'danger.fg'}}> | ||
small | ||
</Label> | ||
<Label variant="medium" sx={{mr: 2}}> | ||
medium (default) | ||
</Label> | ||
<Label variant="large" sx={{mr: 2}}> | ||
large | ||
</Label> | ||
<Label variant="xl">xl label</Label> | ||
|
||
<Box mt={4} /> | ||
<Label variant="medium" sx={{bg: '#A575FF', m: 1}}> | ||
good first issue | ||
</Label> | ||
<Label variant="medium" sx={{bg: '#FF75C8', m: 1}}> | ||
🚂 deploy: train | ||
</Label> | ||
<Label variant="medium" sx={{bg: '#1C90FA', m: 1}}> | ||
css | ||
</Label> | ||
<Label variant="medium" sx={{bg: '#FFF06C', color: '#24292E', m: 1}}> | ||
documentation | ||
</Label> | ||
<Label variant="medium" sx={{bg: '#656BFE', m: 1}}> | ||
primer | ||
</Label> | ||
</> | ||
``` | ||
|
||
## Props | ||
|
||
<PropsTable> | ||
<PropsTableRow name="outline" type="boolean" defaultValue="false" description="Creates an outline style label" /> | ||
<PropsTableRow name="variant" type="'small' | 'medium' | 'large' | 'xl'" defaultValue="'medium'" /> | ||
<PropsTableRow name="dropshadow" type="boolean" defaultValue="false" description="Adds a dropshadow to the label" /> | ||
<PropsTableSxRow /> | ||
</PropsTable> | ||
|
||
## Status | ||
|
||
<ComponentChecklist | ||
items={{ | ||
propsDocumented: true, | ||
noUnnecessaryDeps: false, | ||
adaptsToThemes: true, | ||
adaptsToScreenSizes: false, | ||
fullTestCoverage: false, | ||
usedInProduction: false, | ||
usageExamplesDocumented: true, | ||
designReviewed: false, | ||
a11yReviewed: false, | ||
stableApi: false, | ||
addressedApiFeedback: false, | ||
hasDesignGuidelines: false, | ||
hasFigmaComponent: false | ||
}} | ||
/> |
This file was deleted.
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
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.
These aren't rendering correctly in the docs. I imagine it's because
next
branch hasn't been pulled in yet?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'll look into this
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.
Yes, this is because the
next
branch isn't pulled in yet. It's currently rendering the legacyLabel