Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Dec 7, 2023
1 parent 9f6ab77 commit 69b5fa8
Show file tree
Hide file tree
Showing 18 changed files with 474 additions and 412 deletions.
23 changes: 17 additions & 6 deletions src/OnboardingSPA/components/LivePreview/SiteGenCard/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Icon, search } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

import { LivePreview } from '..';

const LivePreviewSiteGenCard = ( {
Expand All @@ -15,15 +17,15 @@ const LivePreviewSiteGenCard = ( {
onRegenerate,
onPreview,
} ) => {
const handleFavorite = ( slug ) => {
const handleFavorite = () => {
if ( typeof onFavorite === 'function' ) {
return onFavorite( slug );
}

return false;
};

const handleRegenerate = ( slug ) => {
const handleRegenerate = () => {
if ( typeof onRegenerate === 'function' ) {
return onRegenerate( slug );
}
Expand All @@ -50,7 +52,10 @@ const LivePreviewSiteGenCard = ( {
/>
<div
className={ `${ className }__live-preview-container__overlay` }
role="button"
tabIndex={ 0 }
onClick={ () => handlePreview( slug ) }
onKeyDown={ () => handlePreview( slug ) }
>
<div
className={ `${ className }__live-preview-container__overlay__preview-button` }
Expand All @@ -62,7 +67,7 @@ const LivePreviewSiteGenCard = ( {
<p
className={ `${ className }__live-preview-container__overlay__preview-button__text` }
>
Preview
{ __( 'Preview', 'wp-module-onboarding' ) }
</p>
</div>
</div>
Expand All @@ -74,7 +79,10 @@ const LivePreviewSiteGenCard = ( {
isFavorite &&
`${ className }__buttons__favorite__icon__fill`
}` }
onClick={ () => handleFavorite( slug ) }
role="button"
tabIndex={ 0 }
onClick={ () => handleFavorite() }
onKeyDown={ () => handleFavorite() }
/>
<div
className={ `${ className }__buttons__favorite__text` }
Expand All @@ -85,12 +93,15 @@ const LivePreviewSiteGenCard = ( {
<div className={ `${ className }__buttons__regenerate` }>
<div
className={ `${ className }__buttons__regenerate__icon` }
onClick={ () => handleRegenerate( slug ) }
role="button"
tabIndex={ 0 }
onClick={ () => handleRegenerate() }
onKeyDown={ () => handleRegenerate() }
></div>
<div
className={ `${ className }__buttons__regenerate__text` }
>
Regenerate
{ __( 'Regenerate', 'wp-module-onboarding' ) }
</div>
</div>
</div>
Expand Down
238 changes: 122 additions & 116 deletions src/OnboardingSPA/components/LivePreview/SiteGenCard/stylesheet.scss
Original file line number Diff line number Diff line change
@@ -1,117 +1,123 @@
.nfd-onboarding-live-preview {
&--sitegen-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
&__live-preview-container {
position: relative;
width: 90%;
overflow: hidden;
align-items: center;
border-radius: 8px;

&:hover {
cursor: pointer;
}

&__overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
z-index: 2;
width: 100%;
opacity: 0;
transition: 0.5s ease;
background-color: rgba(0,0,0, 1);
display: flex;
align-items: center;
justify-content: center;

&__preview-button {
display: flex;
justify-content: center;
align-items: center;
width: 250px;
height: 30px;
z-index: 9999;
border-radius: 12px;
background-color: var(--nfd-onboarding-primary);
opacity: 1;
&__icon {
fill: var(--nfd-onboarding-secondary);
font-size: 20px;
height: 20px;
width: 20px;
text-align: center;
}
}

&:hover {
cursor: pointer;
opacity: 0.74;
}
}

.live-preview {

&__container {

&-custom {
width: 100%;
overflow: hidden;
height: 300px;
}
}
}

}

&__buttons {
width: 90%;
color: var(--nfd-onboarding-primary);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 16px;
&__favorite {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
&__icon {
width: 20px;
height: 21px;
margin-right: 12px;
cursor: pointer;
background-image: var(--sitegen-favorite);

&__fill {
background-image: var(--sitegen-favorite-filled);
}

}

}

&__regenerate {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
cursor: pointer;
&__icon {
background-image: var(--sitegen-regenerate);
width: 16px;
height: 18px;
margin-right: 12px;
}
}
}
}
}

&--sitegen-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;

&__live-preview-container {
position: relative;
width: 90%;
overflow: hidden;
align-items: center;
border-radius: 8px;

&:hover {
cursor: pointer;
}

&__overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
z-index: 2;
width: 100%;
opacity: 0;
transition: 0.5s ease;
background-color: rgba(0, 0, 0, 1);
display: flex;
align-items: center;
justify-content: center;

&__preview-button {
display: flex;
justify-content: center;
align-items: center;
width: 250px;
height: 30px;
z-index: 9999;
border-radius: 12px;
background-color: var(--nfd-onboarding-primary);
opacity: 1;

&__icon {
fill: var(--nfd-onboarding-secondary);
font-size: 20px;
height: 20px;
width: 20px;
text-align: center;
}
}

&:hover {
cursor: pointer;
opacity: 0.74;
}
}

.live-preview {

&__container {

&-custom {
width: 100%;
overflow: hidden;
height: 300px;
}
}
}

}

&__buttons {
width: 90%;
color: var(--nfd-onboarding-primary);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 16px;

&__favorite {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;

&__icon {
width: 20px;
height: 21px;
margin-right: 12px;
cursor: pointer;
background-image: var(--sitegen-favorite);

&__fill {
background-image: var(--sitegen-favorite-filled);
}

}

}

&__regenerate {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
cursor: pointer;

&__icon {
background-image: var(--sitegen-regenerate);
width: 16px;
height: 18px;
margin-right: 12px;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
getSiteGenIdentifiers,
} from '../../../utils/api/siteGen';
import Footer from '../../Footer';
import { stepSiteGenEditor } from '../../../steps/SiteGen/Editor/step';

// Wrapping the NewfoldInterfaceSkeleton with the HOC to make theme available
const ThemedNewfoldInterfaceSkeleton = themeToggleHOC(
Expand All @@ -26,10 +25,9 @@ const ThemedNewfoldInterfaceSkeleton = themeToggleHOC(
);

const SiteGen = () => {
const { newfoldBrand, currentStep } = useSelect( ( select ) => {
const { newfoldBrand } = useSelect( ( select ) => {
return {
newfoldBrand: select( nfdOnboardingStore ).getNewfoldBrand(),
currentStep: select( nfdOnboardingStore ).getCurrentStep(),
};
}, [] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ const SitegenEditorPatternsSidebar = () => {
setIsSidebarOpened( false );
};
return (
<Fill name={ `${ SIDEBAR_SLOTFILL_PREFIX }/${ SIDEBAR_SITEGEN_EDITOR_PATTERNS }` }>
<Fill
name={ `${ SIDEBAR_SLOTFILL_PREFIX }/${ SIDEBAR_SITEGEN_EDITOR_PATTERNS }` }
>
<PanelBody
className="nfd-onboarding-sidebar--sitegen-editor-patterns"
initialOpen={ true }
>
<Suspense fallback={ <></>}>
<Suspense fallback={ <></> }>
<PanelHeader
label={ __( 'Learn More', 'wp-module-onboarding' ) }
>
Expand Down
Empty file.
31 changes: 14 additions & 17 deletions src/OnboardingSPA/data/sitegen/homepages/homepages.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import {getRandomColorPalette} from '../sitemeta/siteMeta';
import { getRandomColorPalette } from '../sitemeta/siteMeta';
import one from './1.json';
import two from './2.json';
import three from './3.json';
import four from './4.json';
const getHomepages = () => {
return [one, two, three];
}
return [ one, two, three ];
};

const getRandom = ( homepage ) => {
console.log('homepage', homepage);
if ( homepage?.favorite ) {
homepage.slug = homepage.slug + '-copy'
homepage.title = homepage.title + ' Copy'
homepage.favorite = false;
homepage.color = getRandomColorPalette( homepage?.color?.slug );
return homepage;
}
four.color = getRandomColorPalette( homepage?.color?.slug );
return four;
if ( homepage?.favorite ) {
homepage.slug = homepage.slug + '-copy';
homepage.title = homepage.title + ' Copy';
homepage.favorite = false;
homepage.color = getRandomColorPalette( homepage?.color?.slug );
return homepage;
}
four.color = getRandomColorPalette( homepage?.color?.slug );
return four;
};


}

export { getHomepages, getRandom };
export { getHomepages, getRandom };
Loading

0 comments on commit 69b5fa8

Please sign in to comment.