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

Press2 1233 new modern layout component #338

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
56108ad
PRESS2-1233 | creating structure from newfold-skeleton
Oct 17, 2023
fcf7faa
PRESS2-1233 | updated progress bar
Oct 17, 2023
4b60a35
PRESS2-1233 | added toggle
Oct 18, 2023
c491ebb
PRESS2-1233 | added a step
Oct 18, 2023
7203e70
PRESS2-1233
Oct 18, 2023
f5c16db
PRESS2-1233
Oct 18, 2023
b13edd5
PRESS2-1233 fixed linting issues
Oct 20, 2023
11ad03a
PRESS2-1233 | fixed PR comments
Oct 23, 2023
0c4f25a
PRESS2-1233 | fixed linting changes
Oct 23, 2023
00be88d
PRESS2-1233 | fixed style lint
Oct 23, 2023
1271c05
Merge branch 'trunk' of https://github.com/newfold-labs/wp-module-onb…
Oct 25, 2023
92c2b3f
PRESS-1233 | added sitegen to directory
Oct 25, 2023
04cb644
PRESS2-1233 | fixed comments
Oct 25, 2023
f1d893e
PRESS2-1233 | fixed styling
Oct 25, 2023
ecb1d0d
PRESS2-1233 | linting issues
Oct 25, 2023
c41ea1f
PRESS2-1233 | WIP adding styles and static iamges
Oct 26, 2023
e8b8fde
PRESS2-1233 | fixed changes
Oct 26, 2023
2a4acaf
PRESS2-1233 | added theme provider for theme toggle
Oct 27, 2023
8c29637
PRESS2-1233 | fixed linting issues
Oct 27, 2023
af5371e
PRESS2-1233 | fixed indentation
Oct 27, 2023
d4bcb7c
PRESS2-1233 | fixed indentation
Oct 27, 2023
87004bc
PRESS2-1233 | deleted image from static
Oct 27, 2023
042dce7
PRESS2-1233 | added common components
Oct 30, 2023
167d9bb
PRESS2-1233 | fixed linting
Oct 30, 2023
475867f
PRESS2-1233 | fixed linting
Oct 30, 2023
f2b58b1
PRESS2-1233 | toggle in footer
Oct 30, 2023
3730377
PRESS2-1233 | added shared directory for common components
Oct 31, 2023
cc073eb
PRESS2-1233 | fixed linting
Oct 31, 2023
7c1b21b
PRESS2-1233 | fixed linting
Oct 31, 2023
84b4737
changes for design studio
Nov 7, 2023
14eb9e7
Merge branch 'enhance/ai-onboarding' of https://github.com/newfold-la…
Nov 8, 2023
3e5b0e0
PRESS2-1233 | merged changes
Nov 9, 2023
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: 2 additions & 0 deletions src/OnboardingSPA/chapters/demographic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { stepExperience } from '../steps/GetStarted/GetStartedExperience/step';
import { stepPrimarySetup } from '../steps/GetStarted/SiteTypeSetup/PrimarySite/step';
import { stepSecondarySetup } from '../steps/GetStarted/SiteTypeSetup/SecondarySite/step';
import { stepTopPriority } from '../steps/TopPriority/step';
import { stepSiteGenGetStarted } from '../../SiteGenSPA/steps/SiteGenGetStarted/step';
import { Chapter } from '../data/models/Chapter';
import { Step } from '../data/models/Step';
import ChapterInterstitialLoader from '../components/Loaders/Chapter/Interstitial';
Expand All @@ -22,6 +23,7 @@ const steps = [
stepSecondarySetup,
stepBasicInfo,
stepTopPriority,
stepSiteGenGetStarted,
];

export const demographic = new Chapter( {
Expand Down
13 changes: 8 additions & 5 deletions src/OnboardingSPA/components/Animate/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import classNames from 'classnames';

/**
* A Animator to show animation
*
* @param {string} type The name of Animation to be shown.
* @param { object | boolean } after The variable to look after for before showing the animation, by default true to show the children right away.
*
* @param {Object} props The properties passed to the Animate function.
* @param {string} props.type The name of Animation to be shown.
* @param {object | boolean} props.after The variable to look after for before showing the animation, by default true to show the children right away.
* @param {Object} props.children The children of the component.
* @param {string} props.className The optional class name for the animation.
* @param {boolean} props.duration The duration for the animation.
* @param {boolean} props.timingFunction The timing function for the animation.
*/

const Animate = ( {
type,
after = true,
Expand Down
6 changes: 3 additions & 3 deletions src/OnboardingSPA/components/Animate/stylesheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@

@media (prefers-reduced-motion) {
animation: none !important;
translation: none !important;
translate: none !important;
}
}

Expand All @@ -150,7 +150,7 @@

@media (prefers-reduced-motion) {
animation: none !important;
translation: none !important;
translate: none !important;
}
}

Expand All @@ -159,7 +159,7 @@

@media (prefers-reduced-motion) {
animation: none !important;
translation: none !important;
translate: none !important;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import Animate from '../../Animate';
* Checkbox List Skeleton Component
* This returns a List of Checkbox Items Skeletons to imitate loading
*
* @param customItemsList.count
* @param customItemsList.count.count
* @return CheckboxList
* @param {Object} customItemsList - Object containing the count properties.
* @param {number} customItemsList.count - Some description for this count.
* @param {number} customItemsList.count.count - Some description for this nested count.
* @return {Object} CheckboxList - A React component.
*/

const CheckboxListSkeleton = ( { count } ) => {
const buildCheckboxSkeletonItems = () => {
const customItems = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ $main-color-grey-other: #e2e2e2;
}
}

&-full {
width: 100%;
min-height: 90vh;
overflow: hidden;
position: relative;
align-items: center;
border: 1px solid #e3dfdf;
border-top: 0;
margin-bottom: 30px;
}

&--is-skeleton {
z-index: 1;
width: 100%;
Expand Down
3 changes: 3 additions & 0 deletions src/OnboardingSPA/data/flows/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PseudoStep } from '../models/PseudoStep';
import { indexPage } from '../../pages/IndexPage/page';
import { brush } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
import { stepDesignStudioPreview } from '../../../SiteGenSPA/steps/DesignStudio/step';
import { stepTheFork } from '../../steps/TheFork/step';

export const pages = [ indexPage, errorPage ];
Expand All @@ -22,6 +23,7 @@ export const getSteps = ( chapters = initialChapters ) => {
let steps = [];
steps.push( stepTheFork );
steps.push( stepWelcome );
steps.push( stepDesignStudioPreview );
chapters.forEach( ( chapter ) => {
steps = steps.concat( [
...chapter.steps,
Expand All @@ -36,6 +38,7 @@ export const getRoutes = ( chapters = initialChapters ) => {
let routes = [ ...pages ];
routes.push( stepTheFork );
routes.push( stepWelcome );
routes.push( stepDesignStudioPreview );
chapters.forEach( ( chapter ) => {
routes = routes.concat( [
...chapter.steps,
Expand Down
3 changes: 2 additions & 1 deletion src/OnboardingSPA/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { store as nfdOnboardingStore } from './store'; /* must import prior to A
import { getFlow } from './utils/api/flow';
import { DESIGN_STEPS_THEME } from '../constants';

import App from './components/App';
//import App from './components/App';
import App from '../SiteGenSPA/components/App';
import { HashRouter } from 'react-router-dom';
import { dispatch } from '@wordpress/data';
import { render } from '@wordpress/element';
Expand Down
72 changes: 36 additions & 36 deletions src/OnboardingSPA/steps/Ecommerce/StepAddress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
setSidebarActiveView( SIDEBAR_LEARN_MORE );
setDrawerActiveView( VIEW_NAV_ECOMMERCE_STORE_INFO );
setWPSettings();
}, [] );

Check warning on line 102 in src/OnboardingSPA/steps/Ecommerce/StepAddress/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const { currentData, newfoldBrand } = useSelect( ( select ) => {
return {
Expand Down Expand Up @@ -159,7 +159,7 @@
} );
}
}
}, [ settings, currentData.storeDetails, newfoldBrand ] );

Check warning on line 162 in src/OnboardingSPA/steps/Ecommerce/StepAddress/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const { address } = currentData.storeDetails;
const fieldProps = {
Expand Down Expand Up @@ -301,43 +301,43 @@
/>
</div>
{ states.length === 0 ||
address === undefined ? null : (
<div data-name="state">
<label
aria-required
htmlFor="state"
>
{ content.stateInputLabel }
</label>
<select
id="state"
type="text"
name="state"
required
defaultValue={
selectedCountry ===
defaultCountry
? defaultState
: ''
}
{ ...fieldProps }
>
address === undefined ? null : (
<div data-name="state">
<label
aria-required
htmlFor="state"
>
{ content.stateInputLabel }
</label>
<select
id="state"
type="text"
name="state"
required
defaultValue={
selectedCountry ===
defaultCountry
? defaultState
: ''
}
{ ...fieldProps }
>
<option
key={ '' }
value={ '' }
selected
/>
{ states.map( ( state ) => (
<option
key={ '' }
value={ '' }
selected
/>
{ states.map( ( state ) => (
<option
key={ state.code }
value={ state.code }
>
{ state.name }
</option>
) ) }
</select>
</div>
) }
key={ state.code }
value={ state.code }
>
{ state.name }
</option>
) ) }
</select>
</div>
) }
<div data-name="woocommerce_store_postcode">
<label
aria-required
Expand Down
4 changes: 2 additions & 2 deletions src/OnboardingSPA/steps/Ecommerce/StepProducts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
useEffect( () => {
setSidebarActiveView( SIDEBAR_LEARN_MORE );
setDrawerActiveView( VIEW_NAV_ECOMMERCE_STORE_INFO );
}, [] );

Check warning on line 30 in src/OnboardingSPA/steps/Ecommerce/StepProducts/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const handleCheckbox = ( value, checked ) =>
setCurrentOnboardingData( {
Expand All @@ -39,8 +39,8 @@
product_types: checked
? [ ...productInfo?.product_types, value ]
: productInfo?.product_types.filter(
( product ) => product !== value
),
( product ) => product !== value
),
},
},
} );
Expand Down
4 changes: 2 additions & 2 deletions src/OnboardingSPA/steps/Ecommerce/StepTax/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
VIEW_NAV_ECOMMERCE_STORE_INFO,
} from '../../../../constants';
import CardHeader from '../../../components/CardHeader';
import CommonLayout from '../../../components/Layouts/Common';
import CommonLayout from '../../Layouts/Common';

Check failure on line 10 in src/OnboardingSPA/steps/Ecommerce/StepTax/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Unable to resolve path to module '../../Layouts/Common'
import NeedHelpTag from '../../../components/NeedHelpTag';
import NewfoldLargeCard from '../../../components/NewfoldLargeCard';
import { store as nfdOnboardingStore } from '../../../store';
import { useWPSettings as getWPSettings } from '../useWPSettings';
import Animate from '../../../components/Animate';
import Animate from '../../Animate';

Check failure on line 15 in src/OnboardingSPA/steps/Ecommerce/StepTax/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Unable to resolve path to module '../../Animate'
import getContents from './contents';

function createReverseLookup( state ) {
Expand Down Expand Up @@ -44,7 +44,7 @@
setSidebarActiveView( SIDEBAR_LEARN_MORE );
setDrawerActiveView( VIEW_NAV_ECOMMERCE_STORE_INFO );
setWPSettings();
}, [] );

Check warning on line 47 in src/OnboardingSPA/steps/Ecommerce/StepTax/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const content = getContents();

Expand Down Expand Up @@ -72,7 +72,7 @@
},
} );
}
}, [ settings, currentData.storeDetails ] );

Check warning on line 75 in src/OnboardingSPA/steps/Ecommerce/StepTax/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'content.options', 'currentData', and 'setCurrentOnboardingData'. Either include them or remove the dependency array

const { tax } = currentData.storeDetails;
const handleButtonClick = () => {
Expand Down
1 change: 1 addition & 0 deletions src/OnboardingSPA/steps/GetStarted/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useDispatch } from '@wordpress/data';

import { store as nfdOnboardingStore } from '../../store';
// import CommonLayout from '../../components/Layouts/Common';
import CommonLayout from '../../components/Layouts/Common';
import NewfoldLargeCard from '../../components/NewfoldLargeCard';
import { SIDEBAR_LEARN_MORE, VIEW_NAV_GET_STARTED } from '../../../constants';
Expand All @@ -14,7 +15,7 @@

useEffect( () => {
setSidebarActiveView( SIDEBAR_LEARN_MORE );
}, [] );

Check warning on line 18 in src/OnboardingSPA/steps/GetStarted/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

useEffect( () => {}, [ location ] );

Expand All @@ -24,7 +25,7 @@
useEffect( () => {
setIsDrawerOpened( false );
setDrawerActiveView( VIEW_NAV_GET_STARTED );
}, [] );

Check warning on line 28 in src/OnboardingSPA/steps/GetStarted/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

return (
<CommonLayout isBgPrimary isCentered>
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@import "../components/AdminBar/stylesheet";
@import "../components/ProgressBar/stylesheet";
@import "../components/Button/ButtonDark/stylesheet";
@import "../components//SiteGenPlaceholder/stylesheet.scss";
@import "../components/SiteGenPlaceholder/stylesheet.scss";

// CSS for Pages
@import "../steps/BasicInfo/stylesheet";
Expand Down
23 changes: 23 additions & 0 deletions src/SiteGenSPA/components/AdminBar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { __ } from '@wordpress/i18n';
import { Icon, wordpress } from '@wordpress/icons';

const AdminBar = () => {
return (
<div className="nfd-sitegen-admin-bar">
<div className="nfd-admin-bar-wplogo">
<Icon icon={ wordpress } />
<span>{ __( 'WordPress', 'wp-module-onboarding' ) }</span>
</div>
<div className="nfd-sitegen-admin-bar-profile">
<span className="nfd-admin-bar-greeting">
<span>
{ __( 'Howdy!', 'wp-module-onboarding' ) }, Maya Jiménez
</span>
</span>
<div className="nfd-admin-bar-avatar"></div>
</div>
</div>
);
};

export default AdminBar;
47 changes: 47 additions & 0 deletions src/SiteGenSPA/components/AdminBar/stylesheet.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$light-grey : #a0a5aa;

.nfd-sg-interface-skeleton__adminbar {

.nfd-sitegen-admin-bar {
padding: 5px;
background-color: #23282d;
display: flex;
justify-content: space-between;
align-items: center;

.nfd-admin-bar-wplogo {
color: var(--nfd-onboarding-white);
font-size: 16px;
display: flex;
align-items: center;

svg {
color: $light-grey;
fill: $light-grey;
}

span {
margin-left: 15px;
}
}

.nfd-sitegen-admin-bar-profile {
display: flex;
align-items: center;

.nfd-admin-bar-greeting {
color: $light-grey;
font-size: 16px;
margin-right: 5px;
}

.nfd-admin-bar-avatar {
height: 20px;
width: 20px;
display: inline-block;
background-image: var(--adminbar-avatar-img);
background-size: contain;
}
}
}
}
50 changes: 50 additions & 0 deletions src/SiteGenSPA/components/App/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import classNames from 'classnames';
import { useLocation } from 'react-router-dom';
import AdminBar from '../AdminBar';
import ProgressBar from '../ProgressBar';
import Header from '../Header';
import Content from '../../../OnboardingSPA/components/Content';
import ToggleDarkMode from '../ToggleDarkMode';

// eslint-disable-next-line import/no-extraneous-dependencies
import { kebabCase } from 'lodash';
import { useViewportMatch } from '@wordpress/compose';
import { SlotFillProvider } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { FullscreenMode } from '@wordpress/interface';
import SiteGenInterfaceSkeleton from '../SiteGenInterfaceSkeleton';
import { ThemeProvider } from '../ThemeContextProvider';

const App = () => {
const location = useLocation();
const isLargeViewport = useViewportMatch( 'medium' );
const pathname = kebabCase( location.pathname );

return (
<Fragment>
<ThemeProvider>
<FullscreenMode isActive={ true } />
<SlotFillProvider>
<SiteGenInterfaceSkeleton
className={ classNames(
'nfd-sitegen-skeleton',
`brand-sitegen`,
`path-${ pathname }`,
{ 'is-large-viewport': isLargeViewport },
{ 'is-small-viewport': ! isLargeViewport }
) }
adminbar={ <AdminBar /> }
progressbar={
<ProgressBar current={ 20 } total={ 100 } />
}
header={ <Header /> }
content={ <Content /> }
footer={ <ToggleDarkMode /> }
/>
</SlotFillProvider>
</ThemeProvider>
</Fragment>
);
};

export default App;
16 changes: 16 additions & 0 deletions src/SiteGenSPA/components/Header/ActionButton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Icon } from '@wordpress/icons';
import { Button } from '@wordpress/components';

const ActionButton = ( { icon, title } ) => {
return (
<Button
className="navigation-buttons navigation-buttons_back"

Check failure on line 7 in src/SiteGenSPA/components/Header/ActionButton/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Replace `········` with `↹↹↹`
variant="secondary"

Check failure on line 8 in src/SiteGenSPA/components/Header/ActionButton/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Insert `↹`
>
<Icon icon={ icon } />

Check failure on line 10 in src/SiteGenSPA/components/Header/ActionButton/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Replace `····` with `↹`
{ title }

Check failure on line 11 in src/SiteGenSPA/components/Header/ActionButton/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Replace `············` with `↹↹↹`
</Button>
);
};

export default ActionButton;

Check failure on line 16 in src/SiteGenSPA/components/Header/ActionButton/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

Insert `⏎`
Loading
Loading