Skip to content

Commit

Permalink
Add loading state to the banner (#71468)
Browse files Browse the repository at this point in the history
  • Loading branch information
valterlorran authored Dec 23, 2022
1 parent af98552 commit 6d0de5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/my-sites/theme/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ class ThemeSheet extends Component {
isExternallyManagedTheme,
isSiteEligibleForManagedExternalThemes,
isMarketplaceThemeSubscribed,
isLoading,
} = this.props;

const analyticsPath = `/theme/${ themeId }${ section ? '/' + section : '' }${
Expand Down Expand Up @@ -846,6 +847,10 @@ class ThemeSheet extends Component {
onClick = launchPricing;
}

const upsellNudgeClasses = classNames( 'theme__page-upsell-banner', {
'theme__page-upsell-disabled': isLoading,
} );

if ( hasWpComThemeUpsellBanner ) {
const forceDisplay =
( isBundledSoftwareSet && ! isSiteBundleEligible ) ||
Expand All @@ -854,7 +859,7 @@ class ThemeSheet extends Component {
pageUpsellBanner = (
<UpsellNudge
plan={ PLAN_PREMIUM }
className="theme__page-upsell-banner"
className={ upsellNudgeClasses }
title={ this.getBannerUpsellTitle() }
description={ preventWidows( this.getBannerUpsellDescription() ) }
event="themes_plan_particular_free_with_plan"
Expand Down
5 changes: 5 additions & 0 deletions client/my-sites/theme/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@
}
}

.banner.theme__page-upsell-disabled {
pointer-events: none;
opacity: 0.5;
}

.banner.theme__preview-upsell-banner {
@include banner-dark();
width: 100%;
Expand Down

0 comments on commit 6d0de5a

Please sign in to comment.