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

Show Design drawer menu for theme menu and homepage steps #120

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions src/OnboardingSPA/data/routes/default-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
VIEW_DESIGN_COLORS,
VIEW_DESIGN_HEADER_MENU,
VIEW_DESIGN_HOMEPAGE_MENU,
VIEW_DESIGN_THEMES,
VIEW_DESIGN_THEME_STYLES_MENU,
VIEW_DESIGN_THEME_STYLES_PREVIEW,
VIEW_DESIGN_TYPOGRAPHY,
Expand Down Expand Up @@ -401,7 +400,7 @@ export const steps = [
Component: StepDesignThemeStylesMenu,
Icon: styles,
priority: 160,
VIEW: VIEW_DESIGN_THEME_STYLES_MENU,
VIEW: VIEW_NAV_DESIGN,
patternId: 'theme-styles',
sidebars: {
LearnMore: {
Expand Down Expand Up @@ -483,7 +482,7 @@ export const steps = [
Component: StepDesignHomepageMenu,
Icon: header,
priority: 240,
VIEW: VIEW_DESIGN_HOMEPAGE_MENU,
VIEW: VIEW_NAV_DESIGN,
patternId: 'homepage-styles',
sidebars: {
LearnMore: {
Expand Down
4 changes: 2 additions & 2 deletions src/OnboardingSPA/pages/Steps/DesignHomepageMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getPatterns } from '../../../utils/api/patterns';
import { store as nfdOnboardingStore } from '../../../store';
import CommonLayout from '../../../components/Layouts/Common';
import {
VIEW_DESIGN_HOMEPAGE_MENU,
VIEW_NAV_DESIGN,
THEME_STATUS_ACTIVE,
THEME_STATUS_NOT_ACTIVE,
} from '../../../../constants';
Expand Down Expand Up @@ -87,7 +87,7 @@ const StepDesignHomepageMenu = () => {
}
setIsSidebarOpened( false );
setIsDrawerSuppressed( false );
setDrawerActiveView( VIEW_DESIGN_HOMEPAGE_MENU );
setDrawerActiveView( VIEW_NAV_DESIGN );
setIsHeaderNavigationEnabled( true );
}, [] );

Expand Down
15 changes: 8 additions & 7 deletions src/OnboardingSPA/pages/Steps/DesignThemeStyles/Menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useGlobalStylesOutput } from '../../../../utils/global-styles/use-globa
import { getPatterns } from '../../../../utils/api/patterns';
import { getGlobalStyles } from '../../../../utils/api/themes';
import {
VIEW_DESIGN_THEME_STYLES_MENU,
VIEW_NAV_DESIGN,
THEME_STATUS_ACTIVE,
THEME_STATUS_NOT_ACTIVE,
} from '../../../../../constants';
Expand All @@ -21,8 +21,6 @@ import {
} from '../../../../components/LivePreview';

const StepDesignThemeStylesMenu = () => {
const MAX_PREVIEWS_PER_ROW = 3;

const location = useLocation();
const [ isLoaded, setIsLoaded ] = useState( false );
const [ pattern, setPattern ] = useState();
Expand All @@ -49,7 +47,7 @@ const StepDesignThemeStylesMenu = () => {
storedPreviewSettings:
select( nfdOnboardingStore ).getPreviewSettings(),
themeStatus: select( nfdOnboardingStore ).getThemeStatus(),
themeVariations: select(nfdOnboardingStore).getStepPreviewData(),
themeVariations: select( nfdOnboardingStore ).getStepPreviewData(),
};
}, [] );

Expand All @@ -61,7 +59,7 @@ const StepDesignThemeStylesMenu = () => {
updatePreviewSettings,
setCurrentOnboardingData,
updateThemeStatus,
setIsHeaderNavigationEnabled
setIsHeaderNavigationEnabled,
} = useDispatch( nfdOnboardingStore );

useEffect( () => {
Expand All @@ -70,7 +68,7 @@ const StepDesignThemeStylesMenu = () => {
}
setIsSidebarOpened( false );
setIsDrawerSuppressed( false );
setDrawerActiveView( VIEW_DESIGN_THEME_STYLES_MENU );
setDrawerActiveView( VIEW_NAV_DESIGN );
setIsHeaderNavigationEnabled( true );
}, [] );

Expand Down Expand Up @@ -137,7 +135,10 @@ const StepDesignThemeStylesMenu = () => {
<div className="theme-styles-menu__list">
<LivePreviewSkeleton
className={ 'theme-styles-menu__list__item' }
count={ themeVariations[currentStep?.patternId]?.previewCount }
count={
themeVariations[ currentStep?.patternId ]
?.previewCount
}
watch={ pattern && globalStyles }
callback={ buildPreviews }
viewportWidth={ 900 }
Expand Down