-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Studio: Replace button loading indicator with full window one (#362)
* Replace loading state on a button for adding a site --------- Co-authored-by: Kateryna Kodonenko <kateryna@automattic.com>
- Loading branch information
1 parent
9b8c1fe
commit 49312d6
Showing
10 changed files
with
132 additions
and
87 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
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
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,38 @@ | ||
import { useI18n } from '@wordpress/react-i18n'; | ||
import { useEffect } from 'react'; | ||
import { useProgressTimer } from '../hooks/use-progress-timer'; | ||
import ProgressBar from './progress-bar'; | ||
|
||
export function SiteLoadingIndicator( { selectedSiteName }: { selectedSiteName?: string } ) { | ||
const { __ } = useI18n(); | ||
|
||
const { progress, setProgress } = useProgressTimer( { | ||
initialProgress: 20, | ||
interval: 1500, | ||
maxValue: 95, | ||
} ); | ||
|
||
useEffect( () => { | ||
const updateProgress = () => { | ||
setProgress( ( prev ) => { | ||
const increment = Math.random() * 10 + 5; | ||
return Math.min( prev + increment, 95 ); | ||
} ); | ||
}; | ||
|
||
setProgress( 50 ); | ||
const interval = setInterval( updateProgress, 1000 ); | ||
|
||
return () => clearInterval( interval ); | ||
}, [ setProgress ] ); | ||
|
||
return ( | ||
<div className="flex flex-col w-full h-full app-no-drag-region pt-8 overflow-y-auto justify-center items-center"> | ||
<div className="w-[300px] text-center"> | ||
<div className="text-black a8c-subtitle-small mb-4">{ selectedSiteName }</div> | ||
<ProgressBar value={ progress } maxValue={ 100 } /> | ||
<div className="text-a8c-gray-70 a8c-body mt-4">{ __( 'Creating site...' ) }</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
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
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