diff --git a/src/OnboardingSPA/components/Drawer/stylesheet.scss b/src/OnboardingSPA/components/Drawer/stylesheet.scss index bebb0e03f..97e7fd3af 100644 --- a/src/OnboardingSPA/components/Drawer/stylesheet.scss +++ b/src/OnboardingSPA/components/Drawer/stylesheet.scss @@ -273,7 +273,7 @@ $main-border-main: var(--nfd-onboarding-primary-alt); } &--selected { - z-index: 1; + z-index: 2; width: 40px; height: 40px; display: flex; @@ -298,6 +298,7 @@ $main-border-main: var(--nfd-onboarding-primary-alt); &__live-preview-container { position: relative; width: 90%; + overflow: hidden; align-items: center; border: 1px solid #B7B7B7; diff --git a/src/OnboardingSPA/components/LivePreview/BlockPreview/index.js b/src/OnboardingSPA/components/LivePreview/BlockPreview/index.js index 97d2739e7..5300244dd 100644 --- a/src/OnboardingSPA/components/LivePreview/BlockPreview/index.js +++ b/src/OnboardingSPA/components/LivePreview/BlockPreview/index.js @@ -16,18 +16,39 @@ import { store as nfdOnboardingStore } from '../../../store'; * @param root0.viewportWidth * @param root0.styling * @param root0.previewSettings - * @property {string} blockGrammer WordPress block grammer. - * @property {number} viewportWidth Set viewport width for the AutoHeightBlockPreview component. - * @property {string} styling The type of styling to be applied (small, large, custom). + * @param root0.setIsLoadingParent + * @param root0.skeletonLoadingTime + * @property {string} blockGrammer WordPress block grammer. + * @property {number} viewportWidth Set viewport width for the AutoHeightBlockPreview component. + * @property {string} styling The type of styling to be applied (small, large, custom). */ const BlockPreview = ( { blockGrammer, viewportWidth = 1300, styling = 'large', + setIsLoadingParent = false, previewSettings = false, + skeletonLoadingTime = 2500, } ) => { const [ blocks, setBlocks ] = useState(); const [ settings, setSettings ] = useState(); + const [ loading, setIsLoading ] = useState( true ); + + useEffect( () => { + if ( skeletonLoadingTime ) { + const timer = setTimeout( () => { + setIsLoading( false ); + if ( setIsLoadingParent ) { + setIsLoadingParent( false ); + } + }, skeletonLoadingTime ); + return () => clearTimeout( timer ); + } + setIsLoading( false ); + if ( setIsLoadingParent ) { + setIsLoadingParent( false ); + } + }, [ skeletonLoadingTime ] ); const storedPreviewSettings = useSelect( ( select ) => select( nfdOnboardingStore ).getPreviewSettings(), @@ -54,6 +75,15 @@ const BlockPreview = ( { return (
+ { loading && +
+
+
+
+
+
+
+
} { settings && ( { + const [ loadingParent, setIsLoadingParent ] = useState( true ); + return (
onClick() ) } + onClick={ typeof onClick === 'function' && ( () => { + if ( ! loadingParent ) { + onClick(); + } + } ) } >
@@ -30,10 +38,9 @@ const SelectableCard = ( { >
{ overlay && (