-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit Site: Use progress bar for loading screen (#53032)
* Edit Site: Use progress bar for loading screen * Polish theme colors and fallbacks * Utilize Theme for colorizing the ProgressBar * Improve the colors * Rely on theme system to generate the track color * Interface: Add support for content props * Describe interface content region with the progress bar * Add content props only if loading
- Loading branch information
Showing
6 changed files
with
70 additions
and
20 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 |
---|---|---|
@@ -1,12 +1,30 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Spinner } from '@wordpress/components'; | ||
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; | ||
import { privateApis as componentsPrivateApis } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { unlock } from '../../lock-unlock'; | ||
import { useStylesPreviewColors } from '../global-styles/hooks'; | ||
|
||
const { ProgressBar, Theme } = unlock( componentsPrivateApis ); | ||
const { useGlobalStyle } = unlock( blockEditorPrivateApis ); | ||
|
||
export default function CanvasSpinner( { id } ) { | ||
const [ fallbackIndicatorColor ] = useGlobalStyle( 'color.text' ); | ||
const [ backgroundColor ] = useGlobalStyle( 'color.background' ); | ||
const { highlightedColors } = useStylesPreviewColors(); | ||
const indicatorColor = | ||
highlightedColors[ 0 ]?.color ?? fallbackIndicatorColor; | ||
|
||
export default function CanvasSpinner() { | ||
return ( | ||
<div className="edit-site-canvas-spinner"> | ||
<Spinner /> | ||
<Theme accent={ indicatorColor } background={ backgroundColor }> | ||
<ProgressBar id={ id } /> | ||
</Theme> | ||
</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