-
Notifications
You must be signed in to change notification settings - Fork 534
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
Changes from 10 commits
d21ef4f
7bcc7b8
ea882de
e02c828
7b94bb7
15b4322
81520b1
cab0cb5
bc1d25b
8167b2b
705f90d
8d09179
ced30db
7a57ccf
9252b74
e27df7e
6af5cf5
9edff21
cf2e973
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
'@primer/react': major | ||
--- | ||
|
||
![NewLabels](https://user-images.githubusercontent.com/2313998/155384037-8a56c943-4cff-4349-925b-dc28247e3491.png) | ||
|
||
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,90 @@ | ||
--- | ||
title: Label | ||
description: Use Label components to add contextual metadata to a design. | ||
status: Alpha | ||
source: https://github.com/primer/react/blob/main/src/Label.tsx | ||
componentId: label | ||
status: Alpha | ||
source: https://github.com/primer/react/tree/main/src/Label | ||
storybook: '/react/storybook?path=story/labels-label--label' | ||
description: Use Label components to add contextual metadata to a design. | ||
--- | ||
|
||
## Example | ||
## Examples | ||
|
||
```jsx live | ||
<> | ||
<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> | ||
### Basic | ||
|
||
<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> | ||
</> | ||
```javascript live noinline | ||
render(<Label>Default</Label>) | ||
``` | ||
|
||
### Variants | ||
|
||
```javascript live noinline | ||
render( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is because the |
||
<Label>Default</Label> | ||
<Label variant="primary">Primary</Label> | ||
<Label variant="secondary">Secondary</Label> | ||
<Label variant="accent">Accent</Label> | ||
<Label variant="success">Success</Label> | ||
<Label variant="attention">Attention</Label> | ||
<Label variant="severe">Severe</Label> | ||
<Label variant="danger">Danger</Label> | ||
<Label variant="done">Done</Label> | ||
<Label variant="sponsors">Sponsors</Label> | ||
</> | ||
) | ||
``` | ||
|
||
### Sizes | ||
|
||
```javascript live noinline | ||
render( | ||
<> | ||
<Label>Small (default)</Label> | ||
<Label size="large">Large</Label> | ||
</> | ||
) | ||
``` | ||
|
||
## Props | ||
|
||
### Label | ||
|
||
<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 /> | ||
<PropsTableRow | ||
name="variant" | ||
type={`| 'default' | ||
| 'primary' | ||
| 'secondary' | ||
| 'accent' | ||
| 'success' | ||
| 'attention' | ||
| 'severe' | ||
| 'danger' | ||
| 'done' | ||
| 'sponsors'`} | ||
defaultValue="'default'" | ||
description="The color of the label" | ||
/> | ||
<PropsTableRow | ||
name="size" | ||
type="'small' | 'large'" | ||
defaultValue="'small'" | ||
description="How large the label is rendered" | ||
/> | ||
</PropsTable> | ||
|
||
## Status | ||
|
||
<ComponentChecklist | ||
items={{ | ||
propsDocumented: true, | ||
noUnnecessaryDeps: false, | ||
noUnnecessaryDeps: true, | ||
adaptsToThemes: true, | ||
adaptsToScreenSizes: false, | ||
fullTestCoverage: false, | ||
adaptsToScreenSizes: true, | ||
fullTestCoverage: true, | ||
usedInProduction: false, | ||
usageExamplesDocumented: true, | ||
hasStorybookStories: true, | ||
designReviewed: false, | ||
a11yReviewed: false, | ||
stableApi: false, | ||
|
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.
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.
OOO shiny ✨ ... We should do this for the other components too if we're doing this here. Thoughts @mperrotti?
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.
You mean show all the variations? That might not fit neatly into 1 header image 😅
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.
Sorry, no I meant other components being deprecated in v35 don't have header images in their release notes, so this will stand out. We should either do it for all, or not at all IMO.