-
Notifications
You must be signed in to change notification settings - Fork 647
feat(Spinner): make delay customizable #7438
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
Changes from 2 commits
3d13ea6
c57a4a2
aef02e6
eb5d55f
742f566
6bee9d7
be45a92
3503704
18582ef
040947f
d2542ac
9997792
8075976
5a287f2
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,5 @@ | ||
| --- | ||
| '@primer/react': minor | ||
| --- | ||
|
|
||
| feat: make Spinner's delay customizable |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ export type SpinnerProps = { | |
| className?: string | ||
| style?: React.CSSProperties | ||
| /** Whether to delay the spinner before rendering by the defined 1000ms. */ | ||
| delay?: boolean | ||
| delay?: boolean | 'default' | number | ||
|
||
| } & HTMLDataAttributes | ||
|
|
||
| function Spinner({ | ||
|
|
@@ -46,9 +46,10 @@ function Spinner({ | |
|
|
||
| useEffect(() => { | ||
| if (delay) { | ||
| const delayDuration = typeof delay === 'number' ? delay : 1000 | ||
| const timeoutId = setTimeout(() => { | ||
| setIsVisible(true) | ||
| }, 1000) | ||
| }, delayDuration) | ||
|
|
||
| return () => clearTimeout(timeoutId) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.