Skip to content

Commit 311cc9b

Browse files
authored
ProgressBar: Add more progress bar examples (#6269)
1 parent b5efef8 commit 311cc9b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import type {Meta} from '@storybook/react-vite'
2+
import {ProgressBar, Stack} from '..'
3+
import {DotFillIcon} from '@primer/octicons-react'
4+
5+
export default {
6+
title: 'Components/ProgressBar/Examples',
7+
component: ProgressBar,
8+
} as Meta<typeof ProgressBar>
9+
10+
export const WithVisibleTextValue = () => {
11+
return (
12+
<>
13+
<ProgressBar progress={50} aria-label="Loading example" />
14+
<p style={{color: 'var(--fgColor-muted)', font: 'var(--text-body-shorthand-medium)'}}>50% completed</p>
15+
</>
16+
)
17+
}
18+
19+
export const MultipleSegments = () => {
20+
return (
21+
<>
22+
<ProgressBar>
23+
<ProgressBar.Item
24+
progress={30}
25+
style={{backgroundColor: 'var(--bgColor-success-emphasis)'}}
26+
aria-labelledby="done"
27+
/>
28+
<ProgressBar.Item
29+
progress={15}
30+
style={{backgroundColor: 'var(--bgColor-accent-emphasis)'}}
31+
aria-labelledby="in-progress"
32+
/>
33+
<ProgressBar.Item
34+
progress={5}
35+
style={{backgroundColor: 'var(--bgColor-danger-emphasis)'}}
36+
aria-labelledby="closed"
37+
/>
38+
</ProgressBar>
39+
<Stack direction="horizontal" wrap="wrap" marginTop={2}>
40+
<Stack direction="horizontal" gap="condensed" align="center" id="done">
41+
<DotFillIcon fill="var(--bgColor-success-emphasis)" />
42+
Done
43+
</Stack>
44+
<Stack direction="horizontal" gap="condensed" align="center" id="in-progress">
45+
<DotFillIcon fill="var(--bgColor-accent-emphasis)" />
46+
In progress
47+
</Stack>
48+
<Stack direction="horizontal" gap="condensed" align="center" id="closed">
49+
<DotFillIcon fill="var(--bgColor-danger-emphasis)" />
50+
Closed
51+
</Stack>
52+
</Stack>
53+
</>
54+
)
55+
}

0 commit comments

Comments
 (0)