-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:WestpacGEL/GEL-next into develop
- Loading branch information
Showing
4 changed files
with
191 additions
and
138 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
267 changes: 140 additions & 127 deletions
267
apps/site/src/content/design-system/components/badge/design/badge-styles/content.mdoc
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 |
---|---|---|
@@ -1,151 +1,164 @@ | ||
Badges come in 2 different styles: Default, used to highlight words, and Pill, used to highlight numbers. | ||
Badges come in 2 different types: | ||
|
||
- Default - used to highlight words | ||
- Pill - used to highlight numbers | ||
|
||
### Badges - Default | ||
|
||
```tsx | ||
() => { | ||
const COLORS = ['danger', 'warning', 'success', 'info', 'primary', 'hero', 'neutral', 'faint', 'muted'] as const; | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<p className="typography-body-10 text-muted"> | ||
<em>Colours</em> | ||
</p> | ||
<div> | ||
{COLORS.map(color => ( | ||
<Badge color={color} className="my-1 mr-2" > | ||
{color} | ||
</Badge> | ||
))} | ||
</div> | ||
<p className="typography-body-10 text-muted"> | ||
<em>Soft</em> | ||
</p> | ||
<div> | ||
{COLORS.map(color => ( | ||
<Badge color={color} soft className="my-1 mr-2"> | ||
{color} | ||
</Badge> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
<Fragment> | ||
<p className="typography-body-10 text-muted"> | ||
<em>Default</em> | ||
</p> | ||
<p className="my-2"> | ||
<Badge color="primary">Primary</Badge> <Badge color="hero">Hero</Badge> <Badge color="neutral">Neutral</Badge>{' '} | ||
<Badge color="faint">Faint</Badge> <Badge color="success">Success</Badge> <Badge color="info">Info</Badge>{' '} | ||
<Badge color="warning">Warning</Badge> <Badge color="danger">Danger</Badge> | ||
</p> | ||
<p className="typography-body-10 text-muted"> | ||
<em>Soft</em> | ||
</p> | ||
<p className="my-2"> | ||
<Badge color="primary" soft> | ||
Primary | ||
</Badge>{' '} | ||
<Badge color="hero" soft> | ||
Hero | ||
</Badge>{' '} | ||
<Badge color="neutral" soft> | ||
Neutral | ||
</Badge>{' '} | ||
<Badge color="faint" soft> | ||
Faint | ||
</Badge>{' '} | ||
<Badge color="success" soft> | ||
Success | ||
</Badge>{' '} | ||
<Badge color="info" soft> | ||
Info | ||
</Badge>{' '} | ||
<Badge color="warning" soft> | ||
Warning | ||
</Badge>{' '} | ||
<Badge color="danger" soft> | ||
Danger | ||
</Badge> | ||
</p> | ||
</Fragment> | ||
``` | ||
|
||
### Badges - Pill | ||
|
||
```tsx | ||
() => { | ||
const COLORS = ['danger', 'warning', 'success', 'info', 'primary', 'hero', 'neutral', 'faint', 'muted'] as const; | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<p className="typography-body-10 text-muted"> | ||
<em>Colours</em> | ||
<Fragment> | ||
<p className="mb-2 typography-body-10 text-muted"> | ||
<em>Default</em> | ||
</p> | ||
<div> | ||
{COLORS.map(color => ( | ||
<Badge className="my-1 mr-2" type="pill" color={color}> | ||
88 | ||
</Badge> | ||
))} | ||
</div> | ||
<p className="typography-body-10 text-muted"> | ||
<div className="flex gap-1"> | ||
<Badge color="primary" type="pill">88</Badge>{" "} | ||
<Badge color="hero" type="pill">88</Badge>{" "} | ||
<Badge color="neutral" type="pill">88</Badge>{" "} | ||
<Badge color="faint" type="pill">88</Badge>{" "} | ||
|
||
<Badge color="success" type="pill">88</Badge>{" "} | ||
<Badge color="info" type="pill">88</Badge>{" "} | ||
<Badge color="warning" type="pill">88</Badge>{" "} | ||
<Badge color="danger" type="pill">88</Badge> | ||
</p> | ||
<p className="mb-2 mt-2 typography-body-10 text-muted"> | ||
<em>Soft</em> | ||
</p> | ||
<div> | ||
{COLORS.map(color => ( | ||
<Badge className="my-1 mr-2" type="pill" color={color} soft> | ||
88 | ||
</Badge> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
<div className="flex gap-1"> | ||
<Badge color="primary" type="pill" soft>88</Badge>{" "} | ||
<Badge color="hero" type="pill" soft>88</Badge>{" "} | ||
<Badge color="neutral" type="pill" soft>88</Badge>{" "} | ||
<Badge color="faint" type="pill" soft>88</Badge>{" "} | ||
<Badge color="success" type="pill" soft>88</Badge>{" "} | ||
<Badge color="info" type="pill" soft>88</Badge>{" "} | ||
<Badge color="warning" type="pill" soft>88</Badge>{" "} | ||
<Badge color="danger" type="pill" soft>88</Badge> | ||
</p> | ||
</Fragment> | ||
``` | ||
|
||
### Usage examples | ||
|
||
```tsx | ||
() => { | ||
const COLORS = ['danger', 'faint', 'hero', 'info', 'neutral', 'primary', 'success', 'warning'] as const; | ||
const INVERTED_COLORS = [ | ||
'danger-inverted', | ||
'faint-inverted', | ||
'hero-inverted', | ||
'info-inverted', | ||
'neutral-inverted', | ||
'primary-inverted', | ||
'success-inverted', | ||
'warning-inverted', | ||
] as const; | ||
|
||
return ( | ||
<div className="flex flex-col gap-6"> | ||
<div> | ||
<p className="mb-2 typography-body-10 text-muted"> | ||
<em>Examples showing pill style badge</em> | ||
</p> | ||
<div className="flex gap-2"> | ||
<Button look="primary" soft> | ||
<div className="flex gap-1"> | ||
<Badge color="hero" type="pill"> | ||
6 | ||
</Badge> | ||
<span>Label</span> | ||
</div> | ||
</Button> | ||
<Button look="primary"> | ||
<div className="flex gap-1"> | ||
<Badge color="faint" type="pill" soft> | ||
88 | ||
</Badge> | ||
<span>Label</span> | ||
</div> | ||
</Button> | ||
<a className="text-link flex items-center" href="#"> | ||
<div className="underline"> | ||
Messages | ||
</div> | ||
<Badge color="muted" type="pill" className="ml-1"> | ||
12 | ||
</Badge> | ||
</a> | ||
</div> | ||
const COLORS = ['danger', 'faint', 'hero', 'info', 'neutral', 'primary', 'success', 'warning'] as const; | ||
const INVERTED_COLORS = [ | ||
'danger-inverted', | ||
'faint-inverted', | ||
'hero-inverted', | ||
'info-inverted', | ||
'neutral-inverted', | ||
'primary-inverted', | ||
'success-inverted', | ||
'warning-inverted', | ||
] as const; | ||
|
||
return ( | ||
<div className="flex flex-col gap-6"> | ||
<div> | ||
<p className="mb-2 typography-body-10 text-muted"> | ||
<em>Examples showing pill style badge</em> | ||
</p> | ||
<div className="flex gap-2"> | ||
<Button look="primary" soft> | ||
<div className="flex gap-1"> | ||
<Badge color="hero" type="pill"> | ||
6 | ||
</Badge> | ||
<span>Label</span> | ||
</div> | ||
</Button> | ||
<Button look="primary"> | ||
<div className="flex gap-1"> | ||
<Badge color="faint" type="pill" soft> | ||
88 | ||
</Badge> | ||
<span>Label</span> | ||
</div> | ||
</Button> | ||
<a className="text-link underline" href="#"> | ||
Messages{' '} | ||
</a> | ||
<Badge color="muted" type="pill" className="ml-.5"> | ||
12 | ||
</Badge> | ||
</div> | ||
<div> | ||
<p className="mb-2 typography-body-10 text-muted"> | ||
<em>Examples showing basic style badge</em> | ||
</p> | ||
|
||
<div className="flex gap-2"> | ||
<Button look="primary" soft> | ||
<div className="flex gap-1 items-center"> | ||
<span>Label</span> | ||
<Badge color="hero">NEW</Badge> | ||
</div> | ||
</Button> | ||
|
||
<Button look="primary"> | ||
<div className="flex gap-1 items-center"> | ||
<span>Label</span> | ||
<Badge color="faint" soft>NEW</Badge> | ||
</div> | ||
</Button> | ||
|
||
<a className="text-link underline" href="#"> | ||
Product feature | ||
<Badge color="muted" className="ml-1"> | ||
NEW | ||
</Badge> | ||
</a> | ||
</div> | ||
<div> | ||
<p className="mb-2 typography-body-10 text-muted"> | ||
<em>Examples showing basic style badge</em> | ||
</p> | ||
|
||
<div className="flex gap-2"> | ||
<Button look="primary" soft> | ||
<div className="flex gap-1 items-center"> | ||
<span>Label</span> | ||
<Badge color="hero">New</Badge> | ||
</div> | ||
</Button> | ||
|
||
</div> | ||
<Button look="primary"> | ||
<div className="flex gap-1 items-center"> | ||
<span>Label</span> | ||
<Badge color="faint" soft> | ||
New | ||
</Badge> | ||
</div> | ||
</Button> | ||
|
||
<a className="text-link underline" href="#"> | ||
Product feature | ||
</a> | ||
<Badge color="muted" className="ml-.5"> | ||
New | ||
</Badge> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
</div> | ||
); | ||
}; | ||
``` |
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