-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb5bf80
commit 60b3253
Showing
89 changed files
with
1,114 additions
and
292 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,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Add `loading` state to `Button` and `IconButton` |
Binary file modified
BIN
-55 Bytes
(100%)
....test.ts-snapshots/ActionMenu-Groups-And-Descriptions-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-162 Bytes
(99%)
...Menu.test.ts-snapshots/ActionMenu-Groups-And-Descriptions-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-66 Bytes
(100%)
...st.ts-snapshots/ActionMenu-Groups-And-Descriptions-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-55 Bytes
(100%)
.../ActionMenu.test.ts-snapshots/ActionMenu-Groups-And-Descriptions-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-55 Bytes
(100%)
....test.ts-snapshots/ActionMenu-Groups-And-Descriptions-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(100%)
...test.ts-snapshots/ActionMenu-Groups-And-Descriptions-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-40 Bytes
(100%)
...t.ts-snapshots/ActionMenu-Groups-And-Descriptions-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-17 Bytes
(100%)
...ActionMenu.test.ts-snapshots/ActionMenu-Groups-And-Descriptions-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(100%)
...test.ts-snapshots/ActionMenu-Groups-And-Descriptions-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
...ActionMenu.test.ts-snapshots/ActionMenu-Single-Select-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-146 Bytes
(98%)
...nts/ActionMenu.test.ts-snapshots/ActionMenu-Single-Select-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+179 Bytes
(100%)
...ionMenu.test.ts-snapshots/ActionMenu-Single-Select-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
...components/ActionMenu.test.ts-snapshots/ActionMenu-Single-Select-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
...ActionMenu.test.ts-snapshots/ActionMenu-Single-Select-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
...ctionMenu.test.ts-snapshots/ActionMenu-Single-Select-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+199 Bytes
(100%)
...onMenu.test.ts-snapshots/ActionMenu-Single-Select-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7 Bytes
(100%)
...omponents/ActionMenu.test.ts-snapshots/ActionMenu-Single-Select-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
...ctionMenu.test.ts-snapshots/ActionMenu-Single-Select-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.86 KB
....test.ts-snapshots/Button-Loading-Custom-Announcement-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.8 KB
...tton.test.ts-snapshots/Button-Loading-Custom-Announcement-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.85 KB
...st.ts-snapshots/Button-Loading-Custom-Announcement-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.86 KB
...ents/Button.test.ts-snapshots/Button-Loading-Custom-Announcement-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.86 KB
....test.ts-snapshots/Button-Loading-Custom-Announcement-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.9 KB
...test.ts-snapshots/Button-Loading-Custom-Announcement-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.9 KB
...nts/Button.test.ts-snapshots/Button-Loading-Custom-Announcement-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.9 KB
...test.ts-snapshots/Button-Loading-Custom-Announcement-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
....test.ts-snapshots/Button-Loading-With-Leading-Visual-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.76 KB
...tton.test.ts-snapshots/Button-Loading-With-Leading-Visual-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
...st.ts-snapshots/Button-Loading-With-Leading-Visual-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...ents/Button.test.ts-snapshots/Button-Loading-With-Leading-Visual-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
....test.ts-snapshots/Button-Loading-With-Leading-Visual-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.9 KB
...test.ts-snapshots/Button-Loading-With-Leading-Visual-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.89 KB
...nts/Button.test.ts-snapshots/Button-Loading-With-Leading-Visual-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.9 KB
...test.ts-snapshots/Button-Loading-With-Leading-Visual-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
...test.ts-snapshots/Button-Loading-With-Trailing-Visual-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.76 KB
...ton.test.ts-snapshots/Button-Loading-With-Trailing-Visual-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
...t.ts-snapshots/Button-Loading-With-Trailing-Visual-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...nts/Button.test.ts-snapshots/Button-Loading-With-Trailing-Visual-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.86 KB
...test.ts-snapshots/Button-Loading-With-Trailing-Visual-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.9 KB
...est.ts-snapshots/Button-Loading-With-Trailing-Visual-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.88 KB
...ts/Button.test.ts-snapshots/Button-Loading-With-Trailing-Visual-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.9 KB
...est.ts-snapshots/Button-Loading-With-Trailing-Visual-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.86 KB
...ts/components/Button.test.ts-snapshots/Button-Loading-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.8 KB
...pshots/components/Button.test.ts-snapshots/Button-Loading-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.85 KB
...components/Button.test.ts-snapshots/Button-Loading-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.86 KB
...ght/snapshots/components/Button.test.ts-snapshots/Button-Loading-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.86 KB
...ts/components/Button.test.ts-snapshots/Button-Loading-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.9 KB
...s/components/Button.test.ts-snapshots/Button-Loading-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.9 KB
...ht/snapshots/components/Button.test.ts-snapshots/Button-Loading-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.9 KB
...s/components/Button.test.ts-snapshots/Button-Loading-light-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+56 Bytes
(100%)
...ts/components/Dialog.test.ts-snapshots/Dialog-Default-dark-colorblind-linux.png
Oops, something went wrong.
Binary file modified
BIN
-38 Bytes
(100%)
...pshots/components/Dialog.test.ts-snapshots/Dialog-Default-dark-dimmed-linux.png
Oops, something went wrong.
Binary file modified
BIN
+180 Bytes
(100%)
...components/Dialog.test.ts-snapshots/Dialog-Default-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
+52 Bytes
(100%)
...ght/snapshots/components/Dialog.test.ts-snapshots/Dialog-Default-dark-linux.png
Oops, something went wrong.
Binary file modified
BIN
+44 Bytes
(100%)
...ts/components/Dialog.test.ts-snapshots/Dialog-Default-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+69 Bytes
(100%)
...s/components/Dialog.test.ts-snapshots/Dialog-Default-light-colorblind-linux.png
Oops, something went wrong.
Binary file modified
BIN
-58 Bytes
(100%)
...omponents/Dialog.test.ts-snapshots/Dialog-Default-light-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
+86 Bytes
(100%)
...ht/snapshots/components/Dialog.test.ts-snapshots/Dialog-Default-light-linux.png
Oops, something went wrong.
Binary file modified
BIN
+74 Bytes
(100%)
...s/components/Dialog.test.ts-snapshots/Dialog-Default-light-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+32 Bytes
(100%)
...omponents/Dialog.test.ts-snapshots/Dialog-Stress-Test-dark-colorblind-linux.png
Oops, something went wrong.
Binary file modified
BIN
-31 Bytes
(100%)
...ts/components/Dialog.test.ts-snapshots/Dialog-Stress-Test-dark-dimmed-linux.png
Oops, something went wrong.
Binary file modified
BIN
+171 Bytes
(100%)
...onents/Dialog.test.ts-snapshots/Dialog-Stress-Test-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
+91 Bytes
(100%)
...snapshots/components/Dialog.test.ts-snapshots/Dialog-Stress-Test-dark-linux.png
Oops, something went wrong.
Binary file modified
BIN
+25 Bytes
(100%)
...omponents/Dialog.test.ts-snapshots/Dialog-Stress-Test-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+73 Bytes
(100%)
...mponents/Dialog.test.ts-snapshots/Dialog-Stress-Test-light-colorblind-linux.png
Oops, something went wrong.
Binary file modified
BIN
-6 Bytes
(100%)
...nents/Dialog.test.ts-snapshots/Dialog-Stress-Test-light-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
+95 Bytes
(100%)
...napshots/components/Dialog.test.ts-snapshots/Dialog-Stress-Test-light-linux.png
Oops, something went wrong.
Binary file modified
BIN
+78 Bytes
(100%)
...mponents/Dialog.test.ts-snapshots/Dialog-Stress-Test-light-tritanopia-linux.png
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,78 @@ | ||
import React from 'react' | ||
import type {Meta} from '@storybook/react' | ||
import {Button} from '.' | ||
import {DownloadIcon} from '@primer/octicons-react' | ||
import {VisuallyHidden} from '../internal/components/VisuallyHidden' | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: 'Components/Button/Examples', | ||
} as Meta<typeof Button> | ||
|
||
export default meta | ||
|
||
export const LoadingStatusAnnouncementSuccessful = () => { | ||
const [loading, setLoading] = React.useState(false) | ||
const [success, setSuccess] = React.useState(false) | ||
|
||
const resolveAction = async () => { | ||
setLoading(true) | ||
await new Promise(resolve => setTimeout(resolve, 1500)) | ||
setLoading(false) | ||
|
||
return await true | ||
} | ||
|
||
const onClick = (resolveType: 'error' | 'success') => async () => { | ||
const actionResult = await resolveAction() | ||
|
||
if (resolveType === 'error') { | ||
setSuccess(!actionResult) | ||
return | ||
} | ||
|
||
setSuccess(actionResult) | ||
} | ||
|
||
return ( | ||
<> | ||
<VisuallyHidden aria-live="polite">{!loading && success ? 'Export completed' : null}</VisuallyHidden> | ||
<Button loading={loading} leadingVisual={DownloadIcon} onClick={onClick('error')}> | ||
Export (success) | ||
</Button> | ||
</> | ||
) | ||
} | ||
|
||
export const LoadingStatusAnnouncementError = () => { | ||
const [loading, setLoading] = React.useState(false) | ||
const [error, setError] = React.useState(false) | ||
|
||
const resolveAction = async () => { | ||
setLoading(true) | ||
await new Promise(resolve => setTimeout(resolve, 1500)) | ||
setLoading(false) | ||
|
||
return await true | ||
} | ||
|
||
const onClick = (resolveType: 'error' | 'success') => async () => { | ||
const actionResult = await resolveAction() | ||
|
||
if (resolveType === 'error') { | ||
setError(actionResult) | ||
return | ||
} | ||
|
||
setError(!actionResult) | ||
} | ||
|
||
return ( | ||
<> | ||
<VisuallyHidden aria-live="polite">{!loading && error ? 'Export failed' : null}</VisuallyHidden> | ||
|
||
<Button loading={loading} leadingVisual={DownloadIcon} onClick={onClick('error')}> | ||
Export (error) | ||
</Button> | ||
</> | ||
) | ||
} |
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
Oops, something went wrong.