Skip to content
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

Separate out header, content and footer for homepages #438

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"newfold-labs/wp-module-onboarding-data": "^0.1.0",
"newfold-labs/wp-module-patterns": "^0.1.12",
"newfold-labs/wp-module-install-checker": "^1.0",
"newfold-labs/wp-module-facebook": "1.0.0"
"newfold-labs/wp-module-facebook": "^1.0.2"
},
"require-dev": {
"wp-phpunit/wp-phpunit": "^6.2",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package-lock.json

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
Expand Up @@ -110,6 +110,12 @@
const newPreviewSettings = cloneDeep( globalStyles[ 0 ] );
newPreviewSettings.settings.color.palette =
data.color.palette;
let blockGrammar = '';
[ 'header', 'content', 'footer' ].forEach( ( part ) => {
if ( part in data ) {
blockGrammar += data[ part ];
}
} );
return (
<div
className={ `nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container` }
Expand All @@ -128,7 +134,7 @@
? 'custom'
: 'custom__highlighted'
}
blockGrammer={ data.content }
blockGrammer={ blockGrammar }
viewportWidth={ 1300 }
previewSettings={ newPreviewSettings }
skeletonLoadingTime={ 0 }
Expand Down Expand Up @@ -158,7 +164,7 @@
);
} ),
} );
}, [ homepages, activeHomepage, globalStyles ] );

Check warning on line 167 in src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'handleFavorite' and 'handlePreview'. Either include them or remove the dependency array

return (
<Fill
Expand Down Expand Up @@ -206,6 +212,17 @@
);
newPreviewSettings.settings.color.palette =
data.color.palette;
let blockGrammar = '';
[
'header',
'content',
'footer',
].forEach( ( part ) => {
if ( part in data ) {
blockGrammar +=
data[ part ];
}
} );
return (
<div
className={ `nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container` }
Expand All @@ -231,7 +248,7 @@
: 'custom__highlighted'
}
blockGrammer={
data.content
blockGrammar
}
viewportWidth={
1300
Expand Down
9 changes: 8 additions & 1 deletion src/OnboardingSPA/steps/SiteGen/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
setHeaderActiveView( HEADER_SITEGEN );
setDrawerActiveView( false );
loadData();
}, [] );

Check warning on line 48 in src/OnboardingSPA/steps/SiteGen/Editor/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'loadData', 'setDrawerActiveView', 'setHeaderActiveView', and 'setIsHeaderEnabled'. Either include them or remove the dependency array

useEffect( () => {
if ( currentData?.sitegen?.homepages?.active ) {
Expand Down Expand Up @@ -81,9 +81,16 @@
populateFontsInPreviewSettings( newPreviewSettings );
}

let blockGrammar = '';
[ 'header', 'content', 'footer' ].forEach( ( part ) => {
arunshenoy99 marked this conversation as resolved.
Show resolved Hide resolved
if ( part in homepage ) {
blockGrammar += homepage[ part ];
}
} );

return (
<LivePreview
blockGrammer={ homepage.content }
blockGrammer={ blockGrammar }
styling={ 'custom' }
previewSettings={ newPreviewSettings }
viewportWidth={ 1300 }
Expand Down
8 changes: 7 additions & 1 deletion src/OnboardingSPA/steps/SiteGen/Preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
setHeaderActiveView( HEADER_SITEGEN );
setDrawerActiveView( false );
updateInitialize( true );
}, [ currentData ] );

Check warning on line 50 in src/OnboardingSPA/steps/SiteGen/Preview/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'setDrawerActiveView', 'setHeaderActiveView', 'setHideFooterNav', 'setIsHeaderEnabled', 'setSidebarActiveView', and 'updateInitialize'. Either include them or remove the dependency array

const loadHomepages = async () => {
setIsPreviewLoading( true );
Expand Down Expand Up @@ -89,7 +89,7 @@
useEffect( () => {
loadHomepages();
loadGlobalStyles();
}, [] );

Check warning on line 92 in src/OnboardingSPA/steps/SiteGen/Preview/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'loadHomepages'. Either include it or remove the dependency array

const handlePreview = ( slug ) => {
if ( ! ( slug in homepages ) ) {
Expand Down Expand Up @@ -172,10 +172,16 @@
const data = homepages[ slug ];
const newPreviewSettings = cloneDeep( globalStyles[ 0 ] );
newPreviewSettings.settings.color.palette = data.color.palette;
let blockGrammar = '';
[ 'header', 'content', 'footer' ].forEach( ( part ) => {
if ( part in data ) {
blockGrammar += data[ part ];
}
} );
return (
<SiteGenPreviewSelectableCard
key={ idx }
blockGrammar={ data.content }
blockGrammar={ blockGrammar }
previewSettings={ newPreviewSettings }
slug={ slug }
title={ data.title }
Expand Down
Loading