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

Release/v1.0.0 polished #143

Merged
merged 27 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cf6af06
Added Radio Control Skeleton
officiallygod Dec 19, 2022
845257e
Added some Skeleton Placeholder
officiallygod Dec 19, 2022
f52fa01
Added CSS and Dummy Preview
officiallygod Dec 20, 2022
5016c22
Fixed some CSS
officiallygod Dec 20, 2022
06fa3c7
Animation for Loading
officiallygod Dec 20, 2022
0f64418
Refactored CSS
officiallygod Dec 20, 2022
61fbfe0
Removed count param
officiallygod Dec 21, 2022
c1072a5
add the right cursor states
arunshenoy99 Dec 21, 2022
fca8f20
Added New CSS and Toggle feature
officiallygod Dec 21, 2022
6c8e1fd
fix tax logic
arunshenoy99 Dec 21, 2022
babb833
add not-allowed to skeleton states
arunshenoy99 Dec 23, 2022
b358103
Review Comments
officiallygod Dec 26, 2022
91bdda1
Added State Handler
officiallygod Dec 26, 2022
628060a
Revert "Added State Handler"
officiallygod Dec 26, 2022
3f80b38
Revert "Added State Handler"
officiallygod Dec 26, 2022
2e9bf52
Revert "Revert "Added State Handler""
officiallygod Dec 26, 2022
c8202c9
Added State Handler Again
officiallygod Dec 26, 2022
b430246
Added a wait cursor
officiallygod Dec 29, 2022
45305b3
Review Comments
officiallygod Jan 2, 2023
5ff64a1
Replaced with MAP
officiallygod Jan 2, 2023
11f4983
Fixed a Error
officiallygod Jan 2, 2023
83dc3ee
Merge pull request #138 from newfold-labs/PRESS-2-458-Loader-for-Radi…
arunshenoy99 Jan 4, 2023
0b4e51b
Merge pull request #139 from newfold-labs/add/PRESS2-478-live-preview…
arunshenoy99 Jan 4, 2023
2f73e05
Merge pull request #140 from newfold-labs/PRESS-2-470-Improve-Social-…
arunshenoy99 Jan 4, 2023
3bd9abd
Merge pull request #142 from newfold-labs/PRESS-2-474-Generic-Step-Lo…
arunshenoy99 Jan 4, 2023
57eb800
Merge pull request #141 from newfold-labs/fix/PRESS2-403-ecom-tax-ste…
arunshenoy99 Jan 5, 2023
409e352
Merge branch 'trunk' of https://github.com/newfold-labs/wp-module-onb…
arunshenoy99 Jan 5, 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
vendor
.DS_Store
.DS_Store
.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $main-color-light: var(--nfd-onboarding-white);
margin-top: 16px;
background: $main-color-light;
border: 0.5px solid $white-offset;
cursor: not-allowed;
width: clamp(15rem, 25vw, 35rem);
box-shadow: 0px 2px 8px 2px rgba(204, 204, 204, 0.175295);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $main-color-light-rgb: var(--nfd-onboarding-white-rgb);
height: 100%;
display: flex;
position: absolute;
cursor: not-allowed;
align-items: center;
flex-direction: column;
background-color: $main-color-grey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ const SelectableCardWithInfo = ( {
};

return (
<div
className={ `${ className }` }
>
<div className={ `${ className }__live-preview-container` }>
<div className={ `${ className }` }>
<div
className={ `${ className }__live-preview-container` }
onClick={ () => handleCheck( ! selected ) }
>
<LivePreview
styling={ styling }
blockGrammer={ blockGrammer }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ $main-border-main: var(--nfd-onboarding-primary-alt);
align-items: center;
border: 1px solid #e3dfdf;

&:hover {
cursor: pointer;
}

.live-preview {

&__container {

&-custom {
width: 100%;
overflow: hidden;
Expand All @@ -36,4 +41,3 @@ $main-border-main: var(--nfd-onboarding-primary-alt);
}
}


1 change: 1 addition & 0 deletions src/OnboardingSPA/components/Loaders/Step/stylesheet.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.step-loader {

cursor: wait;
justify-content: space-evenly;

@media (max-width: #{($break-medium)}) {
Expand Down
17 changes: 9 additions & 8 deletions src/OnboardingSPA/components/MiniPreview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { translations } from '../../utils/locales/translations';
*
* @returns
*/
const MiniPreview = ({ title, desc, icon, socialData }) => {
const MiniPreview = ({ title, desc, icon, socialData, isSocialFormOpen, setIsSocialFormOpen }) => {

var iconPreview = icon == "" || icon == undefined ? content.icon : icon;
var titlePreview = title == "" ? sprintf(__(content.title, 'wp-module-onboarding'), translations('Site')) : title;
Expand Down Expand Up @@ -70,13 +70,14 @@ const MiniPreview = ({ title, desc, icon, socialData }) => {
}

function socialIconList() {
var socialIconList = []
socialDataset.map( (socialInfo) => {
!socialInfo.url ||
socialIconList.push(
<div key={socialInfo.image} className={`browser-content_social_icon ${isValidUrl(socialInfo.url) || 'invalid-url' }`} style={{ backgroundImage: socialInfo.image }} />)
})
return socialIconList;
return socialDataset.map( (socialInfo) => {
return (
<div key={socialInfo.image}
onClick={(e) => setIsSocialFormOpen(!isSocialFormOpen)}
className={`browser-content_social_icon ${socialInfo.url ? isValidUrl(socialInfo.url) || '--invalid-url' : '--no-url' }`}
style={{ backgroundImage: socialInfo.image }} />
)
})
}

return (
Expand Down
13 changes: 11 additions & 2 deletions src/OnboardingSPA/components/MiniPreview/stylesheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,26 @@ $title-browser-color: #3858E9;
justify-content: flex-start;

&_icon{
opacity: 1;
width: 24px;
height: 24px;
filter: none;
cursor: pointer;
text-align: center;
padding-right: 6px;
background-position: center;
background-repeat: no-repeat;
background-clip: padding-box;
transition: opacity 0.4s ease-in-out;

&.invalid-url {
opacity: 0.8;
&.--no-url {
opacity: 0.5;
filter: grayscale(1);
}

&.--invalid-url {
opacity: 0.75;
filter: none;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Renders Skeletons for Radio Control.
*
* @param {number} options The options to be renedered
*
*/
const RadioControlSkeleton = ({ options }) => {

return <div className="radio-control-skeleton">
{options.map((option) => (<div className="radio-control-skeleton-item" />))}
</div>;
};

export default RadioControlSkeleton;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*COLOR VARIABLES*/
$white-offset: rgb(224, 224, 224);
$main-color-light: var(--nfd-onboarding-white);

.radio-control {

&-main {
animation: fadeIn 300ms ease-in;
}

&-skeleton {
margin: 30px;

&-item {
height: 32px;
margin: 12px;
padding: 10px;
background: transparent;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useState, useEffect } from '@wordpress/element';
import RadioControlSkeleton from '../RadioControlSkeleton';

/**
* A State Handler to manage Radio Control
*
* @param {number} options The options to be renedered.
* @param {string} children The children to be rendered out.
* @param {number} watch The variable to be awaited for to be fetched.
*
*/
const RadioControlStateHandler = ({ options, watch, children }) => {
const [rerender, doRerender] = useState(0);

useEffect(() => doRerender(1), [watch]);

return !watch ? (
<RadioControlSkeleton options={options} />
) : (
<>
{<div style={{ display: 'none' }}>{rerender}</div>}
{children}
</>
);
};

export default RadioControlStateHandler;
2 changes: 2 additions & 0 deletions src/OnboardingSPA/components/RadioControl/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as RadioControlSkeleton } from './RadioControlSkeleton';
export { default as RadioControlStateHandler } from './RadioControlStateHandler';
14 changes: 6 additions & 8 deletions src/OnboardingSPA/components/SocialMediaForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useState, useEffect } from '@wordpress/element';

import Tooltip from './../Tooltip'

const SocialMediaForm = ({ socialData, setSocialData, setIsValidSocials }) => {
const [isActive, setIsActive] = useState(false);
const SocialMediaForm = ({ socialData, setSocialData, setIsValidSocials, isSocialFormOpen, setIsSocialFormOpen }) => {
const [facebook, setFacebook] = useState("");
const [twitter, setTwitter] = useState("");
const [instagram, setInstagram] = useState("");
Expand Down Expand Up @@ -105,11 +104,10 @@ const SocialMediaForm = ({ socialData, setSocialData, setIsValidSocials }) => {
}
}

setDataAndActiveErrorState( data, activeError);
setDataAndActiveErrorState(data, socialInput, activeError);
}

const setDataAndActiveErrorState = (data, activeError) => {

const setDataAndActiveErrorState = (data, socialInput, activeError) => {
if (!data){
var activeErrorFiltered = activeError.filter(function (item) {
return item !== socialInput
Expand All @@ -131,7 +129,7 @@ const SocialMediaForm = ({ socialData, setSocialData, setIsValidSocials }) => {
const checkValidUrlDebounce = _.debounce(checkValidUrl, 1000);

const handleAccordion = (e) => {
setIsActive(!isActive);
setIsSocialFormOpen(!isSocialFormOpen);
}

const handleChange = (e) => {
Expand Down Expand Up @@ -222,9 +220,9 @@ const SocialMediaForm = ({ socialData, setSocialData, setIsValidSocials }) => {
'wp-module-onboarding'
)}
</div>
<div className={`social-form__top-row_icon ${isActive ? 'social-form__top-row_icon_opened' : ''}`}></div>
<div className={`social-form__top-row_icon ${isSocialFormOpen ? 'social-form__top-row_icon_opened' : ''}`}></div>
</div>
<form className={isActive ? 'social-form__main-active' : 'social-form__main-hidden'} onSubmit={(e) => { handleSubmit(e) }}>
<form className={isSocialFormOpen ? 'social-form__main-active' : 'social-form__main-hidden'} onSubmit={(e) => { handleSubmit(e) }}>
{buildSocialBoxes()}
</form>
</div>
Expand Down
15 changes: 13 additions & 2 deletions src/OnboardingSPA/pages/Steps/BasicInfo/basicInfoForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { __, sprintf } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { useState, useEffect } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { useState, useEffect, useRef } from '@wordpress/element';

import content from './content.json';
import TextInput from '../../../components/TextInput';
Expand All @@ -19,6 +19,7 @@ import { translations } from '../../../utils/locales/translations';
* @return
*/
const BasicInfoForm = () => {
const socialMediaRef = useRef(null);
const [ isError, setIsError ] = useState( false );
const [ flowData, setFlowData ] = useState();
const [ isLoaded, setisLoaded ] = useState( false );
Expand All @@ -29,6 +30,7 @@ const BasicInfoForm = () => {
const [ siteLogo, setSiteLogo ] = useState( 0 );
const [ socialData, setSocialData ] = useState( '' );
const [ isValidSocials, setIsValidSocials ] = useState( false );
const [ isSocialFormOpen, setIsSocialFormOpen ] = useState( false );

const { setCurrentOnboardingData } = useDispatch( nfdOnboardingStore );
const { editEntityRecord } = useDispatch( coreStore );
Expand Down Expand Up @@ -64,6 +66,11 @@ const BasicInfoForm = () => {
return dataToSave;
}

useEffect(() => {
if(isSocialFormOpen)
socialMediaRef.current.scrollIntoView();
}, [isSocialFormOpen]);

useEffect( () => {
async function getFlowData() {
const socialDataAPI = await getSettings();
Expand Down Expand Up @@ -183,11 +190,13 @@ const BasicInfoForm = () => {
textValue={ siteDesc }
textValueSetter={ setSiteDesc }
/>
<div>
<div ref={socialMediaRef}>
<SocialMediaForm
socialData={ socialData }
setSocialData={ setSocialData }
isSocialFormOpen={ isSocialFormOpen }
setIsValidSocials={ setIsValidSocials }
setIsSocialFormOpen={ setIsSocialFormOpen }
/>
</div>
</div>
Expand All @@ -201,6 +210,8 @@ const BasicInfoForm = () => {
title={ siteTitle }
desc={ siteDesc }
socialData={ socialData }
isSocialFormOpen={ isSocialFormOpen }
setIsSocialFormOpen={ setIsSocialFormOpen }
/>
</div>
</div>
Expand Down
Loading