diff --git a/src/OnboardingSPA/components/Button/index.js b/src/OnboardingSPA/components/Button/index.js
index a5efeaee4..52d5502d7 100644
--- a/src/OnboardingSPA/components/Button/index.js
+++ b/src/OnboardingSPA/components/Button/index.js
@@ -5,10 +5,10 @@
* @return Button
*/
-const Button = ( { children, onClick, disabled, className } ) => {
+const Button = ( { text, handleClick, disabled, className } ) => {
const handleBtnClick = () => {
- if ( onClick ) {
- onClick();
+ if ( handleClick ) {
+ handleClick();
}
};
@@ -19,7 +19,7 @@ const Button = ( { children, onClick, disabled, className } ) => {
onClick={ handleBtnClick }
disabled={ disabled }
>
- { children }
+ { text }
);
};
diff --git a/src/OnboardingSPA/components/HeadingWithSubHeading/SiteGen/index.js b/src/OnboardingSPA/components/HeadingWithSubHeading/SiteGen/index.js
index e0973c695..a9d22011f 100644
--- a/src/OnboardingSPA/components/HeadingWithSubHeading/SiteGen/index.js
+++ b/src/OnboardingSPA/components/HeadingWithSubHeading/SiteGen/index.js
@@ -12,7 +12,8 @@ import { ThemeContext } from '../../ThemeContextProvider';
*/
const HeadingWithSubHeading = ( { title, subtitle } ) => {
- const { theme } = useContext( ThemeContext );
+ const themeContext = useContext( ThemeContext );
+ const theme = themeContext?.theme || false;
return (
diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js
index 79f4271d1..e677434e4 100644
--- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js
+++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js
@@ -334,7 +334,9 @@ const SiteBuild = () => {
if ( lastChapter !== currentChapter ) {
if ( lastChapter ) {
- currentData.data.chapters[ lastChapter ].completed = true;
+ if ( currentData.data.chapters[ lastChapter ] ) {
+ currentData.data.chapters[ lastChapter ].completed = true;
+ }
trackOnboardingEvent(
new OnboardingEvent(
ACTION_ONBOARDING_CHAPTER_COMPLETE,
@@ -344,7 +346,11 @@ const SiteBuild = () => {
}
if ( currentChapter ) {
- currentData.data.chapters[ currentChapter ].completed = false;
+ if ( currentData.data.chapters[ currentChapter ] ) {
+ currentData.data.chapters[
+ currentChapter
+ ].completed = false;
+ }
trackOnboardingEvent(
new OnboardingEvent(
ACTION_ONBOARDING_CHAPTER_STARTED,
@@ -434,28 +440,35 @@ const SiteBuild = () => {
isForkStep
);
- return (
-
- }
- drawer={ }
- content={ }
- sidebar={ }
- footer={ isForkStep ? : null }
- />
-
- );
+ const commonSkeletonProps = {
+ className: classNames(
+ 'nfd-onboarding-skeleton',
+ `brand-${ newfoldBrand }`,
+ `path-${ pathname }`,
+ { 'is-drawer-open': isDrawerOpen },
+ { 'is-large-viewport': isLargeViewport },
+ { 'is-small-viewport': ! isLargeViewport },
+ { 'nfd-onboarding-skeleton--sitegen': isForkStep }
+ ),
+ header: ,
+ drawer: ,
+ content: ,
+ sidebar: ,
+ footer: isForkStep ? : null,
+ };
+
+ const renderSkeleton = ( Component ) =>
+ isForkStep ? (
+
+
+
+ ) : (
+
+ );
+
+ return isForkStep
+ ? renderSkeleton( ThemedNewfoldInterfaceSkeleton )
+ : renderSkeleton( NewfoldInterfaceSkeleton );
};
export default SiteBuild;
diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
index bd5e914e1..dc1e17083 100644
--- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
+++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
@@ -64,11 +64,16 @@ function NewfoldInterfaceSkeleton(
ref
) {
const navigateRegionsProps = useNavigateRegions( shortcuts );
- const { theme } = useContext( ThemeContext );
- useHTMLClass(
- 'nfd-interface-interface-skeleton__html-container',
- theme === THEME_DARK
- );
+ const isSiteGenFlow = window.nfdOnboarding.currentFlow === 'sitegen';
+ if ( isSiteGenFlow ) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const { theme } = useContext( ThemeContext );
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ useHTMLClass(
+ 'nfd-interface-interface-skeleton__html-container',
+ theme === THEME_DARK
+ );
+ }
const defaultLabels = {
/* translators: accessibility text for the nav bar landmark region. */