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

Add dynamic brand configuration to hide sidebar illustrations for crazy domains #190

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
14 changes: 13 additions & 1 deletion includes/Data/Brands.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static function get_brands() {
'utm_medium' => 'brand-plugin',
),
),
'config' => array(),
),
'bluehost-india' => array(
'brand' => 'bluehost-india',
Expand Down Expand Up @@ -112,6 +113,7 @@ public static function get_brands() {
'utm_medium' => 'brand-plugin',
),
),
'config' => array(),
),
'webcom' => array(
'brand' => 'webcom',
Expand Down Expand Up @@ -163,8 +165,9 @@ public static function get_brands() {
'utm_medium' => '',
),
),
'config' => array(),
),
'crazy-domains' => array(
'crazy-domains' => array(
'brand' => 'crazy-domains',
'name' => 'Crazy Domains',
'url' => 'https://www.crazydomains.com',
Expand Down Expand Up @@ -213,6 +216,15 @@ public static function get_brands() {
'utm_medium' => 'brand-plugin',
),
),
'config' => array(
'views' => array(
'sidebar' => array(
'illustration' => array(
'shown' => false,
),
),
),
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { PanelBody } from '@wordpress/components';
const IllustrationPanel = ( {
cssIcon = 'nfd-onboarding-sidebar-learn-more-get-started-welcome-illustration',
baseClassName = 'nfd-onboarding-sidebar-learn-more--illustration-panel',
backgroundPosition = 'center'
backgroundPosition = 'center',
} ) => {
const iconExists = window.getComputedStyle( document.body ).getPropertyValue( `--${ cssIcon }` ) !== '';

return (
<PanelBody
iconExists && <PanelBody
className={ `${ baseClassName }__container` }
initialOpen={ true }
>
Expand All @@ -18,7 +20,7 @@ const IllustrationPanel = ( {
height: '100%',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundPosition: backgroundPosition,
backgroundPosition,
} }
></div>
</PanelBody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { useSelect } from '@wordpress/data';
import { Fragment } from '@wordpress/element';

import Animate from '../../../../Animate';
import { store as nfdOnboardingStore } from '../../../../../store';

/** Skeleton Structure for the SideBar */
const SidebarSkeleton = () => {
const { brandConfig } = useSelect( ( select ) => {
return {
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

return (
<div className="sidebar-skeleton">
<div className="sidebar-skeleton-header">
Expand All @@ -27,13 +37,15 @@ const SidebarSkeleton = () => {
</div>
</div>
<div className="sidebar-skeleton-divider" />
<div className="sidebar-skeleton-body">
<Animate
type={ 'shine-placeholder' }
className="shimmer sidebar-skeleton-body-image"
/>
</div>
<div className="sidebar-skeleton-divider" />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false && <Fragment>
<div className="sidebar-skeleton-body">
<Animate
type={ 'shine-placeholder' }
className="shimmer sidebar-skeleton-body-image"
/>
</div>
<div className="sidebar-skeleton-divider" />
</Fragment> }
<div className="sidebar-skeleton-footer">
<Animate
type={ 'shine-placeholder' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -47,7 +48,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand All @@ -57,7 +59,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.open( content.help.fullService.link, '_blank') )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -47,7 +47,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -47,7 +47,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -47,7 +47,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -51,7 +52,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -51,7 +52,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -45,7 +46,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -51,7 +52,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand All @@ -61,7 +63,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.open( content.help.fullService.link, '_blank') )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -51,7 +52,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand All @@ -61,7 +63,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.open( content.help.fullService.link, '_blank') )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } =
const { brandName, techSupportLink, fullServiceCreativeTeamLink, brandConfig } =
useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
Expand All @@ -44,6 +44,7 @@ const LearnMore = () => {
select(
nfdOnboardingStore
).getfullServiceCreativeTeamUrl(),
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
};
} );

Expand All @@ -60,7 +61,8 @@ const LearnMore = () => {
subheading={ content.introduction.subheading }
icon={ content.introduction.icon }
/>
<IllustrationPanel cssIcon={ content.illustration.icon } />
{ brandConfig?.views?.sidebar?.illustration?.shown !== false &&
<IllustrationPanel cssIcon={ content.illustration.icon } /> }
<InfoPanel
headingWithDescriptions={
content.information.headingWithDescriptions
Expand Down
Loading