-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #360 from newfold-labs/Customer-detail-and-experie…
…nce-steps-merger Customer Detail and Experience and Site Generation Pages
- Loading branch information
Showing
38 changed files
with
871 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Icon, chevronRight } from '@wordpress/icons'; | ||
|
||
const CardWithOptions = ( { title, options, skip, callback } ) => { | ||
const buildOptions = () => { | ||
return options.map( ( data, idx ) => { | ||
return ( | ||
<div | ||
key={ idx } | ||
role="button" | ||
tabIndex={ 0 } | ||
className={ 'nfd-sg-card__data__option' } | ||
onClick={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( idx + 1 ); | ||
} | ||
} } | ||
onKeyDown={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( idx + 1 ); | ||
} | ||
} } | ||
> | ||
<div className={ 'nfd-sg-card__data__option__left' }> | ||
<div | ||
className={ 'nfd-sg-card__data__option__left_top' } | ||
> | ||
{ data.title } | ||
</div> | ||
<div | ||
className={ | ||
'nfd-sg-card__data__option__left_bottom' | ||
} | ||
> | ||
{ data.desc } | ||
</div> | ||
</div> | ||
<Icon | ||
className={ 'nfd-sg-card__data__option__right' } | ||
icon={ chevronRight } | ||
/> | ||
</div> | ||
); | ||
} ); | ||
}; | ||
|
||
return ( | ||
<div className={ 'nfd-sg-card' }> | ||
<div className={ 'nfd-sg-card__title' }>{ title }</div> | ||
<div className={ 'nfd-sg-card__data' }>{ buildOptions() }</div> | ||
<div | ||
role="button" | ||
tabIndex={ 0 } | ||
className={ 'nfd-sg-card__skip' } | ||
onClick={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( -1 ); | ||
} | ||
} } | ||
onKeyDown={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( -1 ); | ||
} | ||
} } | ||
> | ||
{ skip } | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CardWithOptions; |
79 changes: 79 additions & 0 deletions
79
src/OnboardingSPA/components/CardWithOptions/stylesheet.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
$background-color: var(--nfd-onboarding-card-background); | ||
|
||
.nfd-sg-card { | ||
|
||
margin: 8px; | ||
max-width: 90vw; | ||
padding: 24px 12px; | ||
border-radius: 12px; | ||
background-color: $background-color; | ||
width: clamp(18.75rem, 22.6136rem + 5.6818vw, 31.25rem); | ||
box-shadow: 3px 3px 5px rgba(var(--nfd-onboarding-primary-rgb), $alpha: 0.05); | ||
|
||
&__title { | ||
color: var(--nfd-onboarding-primary); | ||
margin: 16px; | ||
line-height: 2; | ||
font-size: 18px; | ||
text-align: center; | ||
margin-bottom: 30px; | ||
letter-spacing: 1.5px; | ||
} | ||
|
||
&__data { | ||
margin: 12px; | ||
|
||
&__option { | ||
display: flex; | ||
cursor: pointer; | ||
margin: 16px 4px; | ||
align-items: center; | ||
border-radius: 4px 4px 0 0; | ||
padding: 16px 12px 20px 12px; | ||
justify-content: space-between; | ||
transition: background-color 400ms ease-in-out; | ||
|
||
&:not(:last-child) { | ||
border-bottom: 0.5px solid rgba(var(--nfd-onboarding-primary-rgb), 0.3); | ||
} | ||
|
||
&:hover { | ||
background-color: var(--nfd-onboarding-hover); | ||
} | ||
|
||
&__left_top { | ||
color: var(--nfd-onboarding-primary); | ||
font-size: 16px; | ||
font-weight: 500; | ||
padding-bottom: 12px; | ||
} | ||
|
||
&__left_bottom { | ||
color: var(--nfd-onboarding-primary); | ||
font-size: 14px; | ||
font-weight: 300; | ||
} | ||
|
||
&__right { | ||
fill: var(--nfd-onboarding-primary); | ||
transition: all 200ms ease-in-out; | ||
|
||
&:hover { | ||
transform: scale(1.1); | ||
} | ||
} | ||
} | ||
} | ||
|
||
&__skip { | ||
cursor: pointer; | ||
text-align: end; | ||
margin: 0 20px 6px 20px; | ||
transition: color 200ms ease-in-out; | ||
color: rgba(var(--nfd-onboarding-primary-rgb), 0.8); | ||
|
||
&:hover { | ||
color: var(--nfd-onboarding-primary); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const AIHeading = ( { title } ) => { | ||
return ( | ||
<div className={ 'ai-heading' }> | ||
<div className={ 'ai-heading--icon' } /> | ||
<div className={ 'ai-heading--title' }>{ title }</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AIHeading; |
24 changes: 24 additions & 0 deletions
24
src/OnboardingSPA/components/Heading/AIHeading/stylesheet.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.ai-heading { | ||
|
||
display: flex; | ||
margin-bottom: 20px; | ||
align-items: center; | ||
|
||
&--icon { | ||
width: 50px; | ||
margin: 4px; | ||
height: 50px; | ||
background-size: 200%; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
background-image: var(--sitegen-ai-animation); | ||
} | ||
|
||
&--title { | ||
margin: 10px; | ||
line-height: 1.5; | ||
font-weight: 500; | ||
font-size: 1.2rem; | ||
color: var(--nfd-onboarding-primary); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
src/OnboardingSPA/components/Loaders/SiteGenLoader/contents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
const getContents = () => { | ||
return { | ||
title: __( 'Building Website', 'wp-module-onboarding' ), | ||
status: [ | ||
{ | ||
title: __( 'Generating Website', 'wp-module-onboarding' ), | ||
}, | ||
{ | ||
title: __( 'Finding Font Pairings', 'wp-module-onboarding' ), | ||
}, | ||
{ | ||
title: __( | ||
'Building Custom Color Palettes', | ||
'wp-module-onboarding' | ||
), | ||
}, | ||
{ | ||
title: __( 'Populating Images', 'wp-module-onboarding' ), | ||
}, | ||
{ | ||
title: __( 'Finalizing Previews', 'wp-module-onboarding' ), | ||
}, | ||
{ | ||
title: __( 'Packaging Website', 'wp-module-onboarding' ), | ||
}, | ||
], | ||
}; | ||
}; | ||
|
||
export default getContents; |
64 changes: 64 additions & 0 deletions
64
src/OnboardingSPA/components/Loaders/SiteGenLoader/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import getContents from './contents'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { useEffect, useState } from '@wordpress/element'; | ||
import { store as nfdOnboardingStore } from '../../../store'; | ||
|
||
const SiteGenLoader = ( { autoNavigate = false } ) => { | ||
let statusIdx = 0; | ||
const content = getContents(); | ||
const navigate = useNavigate(); | ||
const [ percentage, setPercentage ] = useState( 0 ); | ||
const [ status, setStatus ] = useState( content.status[ statusIdx ].title ); | ||
|
||
const { nextStep } = useSelect( ( select ) => { | ||
return { | ||
nextStep: select( nfdOnboardingStore ).getNextStep(), | ||
}; | ||
} ); | ||
|
||
const checkStatus = async () => { | ||
// Make fake API Call to get the status. | ||
if ( percentage !== 100 ) setPercentage( ( t ) => t + 10 ); | ||
}; | ||
|
||
useEffect( () => { | ||
const statusTimer = setInterval( () => { | ||
checkStatus(); | ||
statusIdx += 1; | ||
Check warning on line 28 in src/OnboardingSPA/components/Loaders/SiteGenLoader/index.js GitHub Actions / Run Lint Checks
|
||
if ( statusIdx === content.status.length ) statusIdx = 0; | ||
setStatus( content.status[ statusIdx ].title ); | ||
}, 3000 ); | ||
return () => { | ||
clearInterval( statusTimer ); | ||
}; | ||
}, [] ); | ||
|
||
useEffect( () => { | ||
if ( percentage === 100 ) { | ||
if ( nextStep && autoNavigate ) { | ||
navigate( nextStep.path ); | ||
} | ||
} | ||
}, [ percentage ] ); | ||
Check warning on line 43 in src/OnboardingSPA/components/Loaders/SiteGenLoader/index.js GitHub Actions / Run Lint Checks
|
||
|
||
return ( | ||
<div className={ 'nfd-sg-loader' }> | ||
<div className={ 'nfd-sg-loader__title' }>{ content.title }</div> | ||
<div className={ 'nfd-sg-loader__progress' }> | ||
<div className={ 'nfd-sg-loader__progress_bars' }> | ||
<div className={ 'nfd-sg-loader__progress_bars_bg' } /> | ||
<div | ||
className={ 'nfd-sg-loader__progress_bars_bar' } | ||
style={ { width: `${ percentage }%` } } | ||
/> | ||
</div> | ||
</div> | ||
<div | ||
className={ 'nfd-sg-loader__status' } | ||
>{ `${ status }...` }</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SiteGenLoader; |
Oops, something went wrong.