-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate legacy Label component (#1889)
* moves Label to deprecated bundle * graduates Label2 to main bundle * cleanup * adds changeset * fixes tests * update legacy label snapshots * Update .changeset/heavy-points-marry.md Co-authored-by: Rez <rezrah@github.com> * Update docs/content/Label.mdx Co-authored-by: Rez <rezrah@github.com> * addresses pr feedback * adds Label back to sidebar * updates tests, removes docs header image * removes docs header image * fixes tests * resets changed test Co-authored-by: Rez <rezrah@github.com>
- Loading branch information
Showing
19 changed files
with
413 additions
and
372 deletions.
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.