From e5f18adb1ba46a2203d331c3919060f7eab50726 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Wed, 29 Nov 2023 14:13:55 +0530 Subject: [PATCH] Minor dark mode fixes and slot filled footers --- .../Footer/components/SiteGenFooter/index.js | 15 ++++++ src/OnboardingSPA/components/Footer/index.js | 37 ++++++++++++++ .../components/Footer/stylesheet.scss | 22 ++++++++ .../SiteBuild/index.js | 10 ++-- .../NewfoldInterfaceSkeleton/SiteGen/index.js | 5 +- .../themeToggleHOC.js | 5 +- .../components/ToggleDarkMode/index.js | 50 +++++++++++-------- .../components/ToggleDarkMode/stylesheet.scss | 8 ++- src/OnboardingSPA/data/footers/index.js | 15 ++++++ .../steps/SiteGen/Experience/index.js | 2 - .../steps/SiteGen/SiteDetails/index.js | 1 - src/OnboardingSPA/steps/TheFork/index.js | 4 +- src/OnboardingSPA/store/actions.js | 7 +++ src/OnboardingSPA/store/reducer.js | 21 ++++++++ src/OnboardingSPA/store/selectors.js | 8 +++ src/OnboardingSPA/styles/app.scss | 1 + src/constants.js | 4 ++ 17 files changed, 175 insertions(+), 40 deletions(-) create mode 100644 src/OnboardingSPA/components/Footer/components/SiteGenFooter/index.js create mode 100644 src/OnboardingSPA/components/Footer/index.js create mode 100644 src/OnboardingSPA/components/Footer/stylesheet.scss create mode 100644 src/OnboardingSPA/data/footers/index.js diff --git a/src/OnboardingSPA/components/Footer/components/SiteGenFooter/index.js b/src/OnboardingSPA/components/Footer/components/SiteGenFooter/index.js new file mode 100644 index 000000000..793f63d04 --- /dev/null +++ b/src/OnboardingSPA/components/Footer/components/SiteGenFooter/index.js @@ -0,0 +1,15 @@ +import { Fill } from '@wordpress/components'; +import { FOOTER_SITEGEN, FOOTER_START } from '../../../../../constants'; +import ToggleDarkMode from '../../../ToggleDarkMode'; + +const SiteGenFooter = () => { + return ( + <> + + + + + ); +}; + +export default SiteGenFooter; diff --git a/src/OnboardingSPA/components/Footer/index.js b/src/OnboardingSPA/components/Footer/index.js new file mode 100644 index 000000000..6a115f458 --- /dev/null +++ b/src/OnboardingSPA/components/Footer/index.js @@ -0,0 +1,37 @@ +import { FOOTER_END, FOOTER_START } from '../../../constants'; +import { Slot } from '@wordpress/components'; +import { useSelect } from '@wordpress/data'; +import { Fragment, Suspense } from '@wordpress/element'; + +import { store as nfdOnboardingStore } from '../../store'; + +const Footer = () => { + const { footers, footerActiveView } = useSelect( ( select ) => { + return { + footers: select( nfdOnboardingStore ).getFooters(), + footerActiveView: + select( nfdOnboardingStore ).getFooterActiveView(), + }; + } ); + return ( +
+ }> + { footers.map( ( footer ) => { + return ( + + + + ); + } ) } + +
+ +
+
+ +
+
+ ); +}; + +export default Footer; diff --git a/src/OnboardingSPA/components/Footer/stylesheet.scss b/src/OnboardingSPA/components/Footer/stylesheet.scss new file mode 100644 index 000000000..2564f6d92 --- /dev/null +++ b/src/OnboardingSPA/components/Footer/stylesheet.scss @@ -0,0 +1,22 @@ +.nfd-onboarding-footer { + position: absolute; + bottom: 0; + left: 0; + z-index: 1; + + display: flex; + flex-direction: row; + + height: auto; + width: 100%; + border: none; + + &__end { + position: absolute; + right: 25px; + } + + &--background { + background-color: rgba(var(--nfd-onboarding-secondary-rgb), 0.75); + } +} diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js index 9681c3f9b..79f4271d1 100644 --- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js +++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js @@ -2,7 +2,6 @@ import Header from '../../Header'; import Content from '../../Content'; import Drawer from '../../Drawer'; import Sidebar from '../../Sidebar'; -import ToggleDarkMode from '../../ToggleDarkMode'; import classNames from 'classnames'; import { useLocation } from 'react-router-dom'; import { setFlow } from '../../../utils/api/flow'; @@ -55,6 +54,7 @@ import { trigger as cronTrigger } from '../../../utils/api/cronTrigger'; import { stepTheFork } from '../../../steps/TheFork/step'; import { ThemeProvider } from '../../ThemeContextProvider'; import themeToggleHOC from '../themeToggleHOC'; +import Footer from '../../Footer'; const SiteBuild = () => { const location = useLocation(); @@ -423,7 +423,7 @@ const SiteBuild = () => { handleConditionalDesignStepsRoutes(); }, [ location.pathname, onboardingFlow ] ); - const shouldApplyTheme = + const isForkStep = currentStep === stepTheFork || window.nfdOnboarding.currentFlow === 'sitegen'; // wrapping the NewfoldInterfaceSkeleton with the HOC to make 'theme' available @@ -431,7 +431,7 @@ const SiteBuild = () => { NewfoldInterfaceSkeleton, 'nfd-onboarding-sitegen-dark', 'nfd-onboarding-sitegen-light', - shouldApplyTheme + isForkStep ); return ( @@ -445,14 +445,14 @@ const SiteBuild = () => { { 'is-large-viewport': isLargeViewport }, { 'is-small-viewport': ! isLargeViewport }, { - 'nfd-onboarding-skeleton--sitegen': shouldApplyTheme, + 'nfd-onboarding-skeleton--sitegen': isForkStep, } ) } header={
} drawer={ } content={ } sidebar={ } - footer={ shouldApplyTheme ? : null } + footer={ isForkStep ?