Skip to content

Commit 036315f

Browse files
authored
Adds purple badge (#3046)
1 parent 67ad755 commit 036315f

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

.changeset/ninety-kings-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/badge': minor
3+
---
4+
5+
Adds `purple` to Variant set

packages/badge/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import Badge from '@leafygreen-ui/badge';
3636

3737
## Properties
3838

39-
| Prop | Type | Description | Default |
40-
| ----------- | --------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------- |
41-
| `variant` | `'lightgray'`, `'darkgray'`, `'red'`, `'blue'`, `'green'`, `'yellow'` | Sets the style variant of the badge. | `'lightgray'` |
42-
| `className` | `string` | Adds a className to the class attribute | |
43-
| `children` | `node` | The content that will appear inside of the `<Badge />` component. | |
44-
| ... | native `div` attributes | Any other props will be spread on the root `div` element | |
45-
| `darkMode` | `boolean` | Determines if the component renders in dark theme | `false` |
39+
| Prop | Type | Description | Default |
40+
| ----------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------- |
41+
| `variant` | `'lightgray'`, `'darkgray'`, `'red'`, `'blue'`, `'green'`, `'yellow'`, `'purple'` | Sets the style variant of the badge. | `'lightgray'` |
42+
| `className` | `string` | Adds a className to the class attribute | |
43+
| `children` | `node` | The content that will appear inside of the `<Badge />` component. | |
44+
| ... | native `div` attributes | Any other props will be spread on the root `div` element | |
45+
| `darkMode` | `boolean` | Determines if the component renders in dark theme | `false` |

packages/badge/src/Badge/Badge.styles.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ export const badgeVariants: Record<Theme, Record<Variant, string>> = {
5858
border-color: ${palette.green.dark2};
5959
color: ${palette.green.light1};
6060
`,
61+
62+
[Variant.Purple]: css`
63+
background-color: ${palette.purple.dark2};
64+
border-color: ${palette.purple.base};
65+
color: ${palette.purple.light2};
66+
`,
6167
},
6268
[Theme.Light]: {
6369
[Variant.LightGray]: css`
@@ -95,5 +101,11 @@ export const badgeVariants: Record<Theme, Record<Variant, string>> = {
95101
border-color: ${palette.green.light2};
96102
color: ${palette.green.dark2};
97103
`,
104+
105+
[Variant.Purple]: css`
106+
background-color: ${palette.purple.light3};
107+
border-color: ${palette.purple.light2};
108+
color: ${palette.purple.dark2};
109+
`,
98110
},
99111
} as const;

packages/badge/src/Badge/Badge.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const Variant = {
2626
Yellow: 'yellow',
2727
Blue: 'blue',
2828
Green: 'green',
29+
Purple: 'purple',
2930
} as const;
3031

3132
export type Variant = (typeof Variant)[keyof typeof Variant];

0 commit comments

Comments
 (0)