Skip to content

Commit

Permalink
Shrink Big Sky beta label
Browse files Browse the repository at this point in the history
  • Loading branch information
p-jackson committed Jan 31, 2025
1 parent c03a992 commit 2f163a6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
font-weight: 500;
line-height: 24px;
text-align: left;

.design-choices__beta-label {
font-size: $font-body-extra-small;
font-weight: 600;
line-height: 14px;
text-align: left;
}
}

.goals-first-design-choice__description {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import './goals-first-design-choice.scss';

interface Props {
className?: string;
title: string;
title: string | React.ReactElement;
ariaLabel?: string;
description: string;
bgImageSrc?: string;
fgImageSrc?: string;
Expand All @@ -17,44 +18,49 @@ interface Props {
const GoalsFirstDesignChoice = ( {
className,
title,
ariaLabel: _ariaLabel,
description,
bgImageSrc,
fgImageSrc,
destination,
onSelect,
badgeLabel,
}: Props ) => (
<button
className={ clsx( 'goals-first-design-choice', className ) }
aria-label={ title }
onClick={ () => onSelect( destination ) }
>
<div className="goals-first-design-choice__content">
<div className="goals-first-design-choice__background">
{ badgeLabel && (
<Badge type="info-blue" className="goals-first-design-choice__price-badge">
{ badgeLabel }
</Badge>
) }
<div className="goals-first-design-choice__background-item">
{ bgImageSrc && <img src={ bgImageSrc } alt={ title } /> }
{ fgImageSrc && (
<img
className="goals-first-design-choice__foreground-image"
src={ fgImageSrc }
alt={ title }
/>
}: Props ) => {
const ariaLabel = ! _ariaLabel && typeof title === 'string' ? title : _ariaLabel;

return (
<button
className={ clsx( 'goals-first-design-choice', className ) }
aria-label={ ariaLabel }
onClick={ () => onSelect( destination ) }
>
<div className="goals-first-design-choice__content">
<div className="goals-first-design-choice__background">
{ badgeLabel && (
<Badge type="info-blue" className="goals-first-design-choice__price-badge">
{ badgeLabel }
</Badge>
) }
<div className="goals-first-design-choice__background-item">
{ bgImageSrc && <img src={ bgImageSrc } alt={ ariaLabel } /> }
{ fgImageSrc && (
<img
className="goals-first-design-choice__foreground-image"
src={ fgImageSrc }
alt={ ariaLabel }
/>
) }
</div>
</div>
</div>
<div className="goals-first-design-choice__foreground">
<div className="goals-first-design-choice__title">{ title }</div>
<div className="goals-first-design-choice__description">
{ preventWidows( description ) }
<div className="goals-first-design-choice__foreground">
<div className="goals-first-design-choice__title">{ title }</div>
<div className="goals-first-design-choice__description">
{ preventWidows( description ) }
</div>
</div>
</div>
</div>
</button>
);
</button>
);
};

export default GoalsFirstDesignChoice;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isEnabled } from '@automattic/calypso-config';
import { PLAN_PERSONAL } from '@automattic/calypso-products';
import { OnboardSelect, ProductsList } from '@automattic/data-stores';
import { themesIllustrationImage } from '@automattic/design-picker';
import { localizeUrl } from '@automattic/i18n-utils';
import { localizeUrl, useHasEnTranslation } from '@automattic/i18n-utils';
import { StepContainer, isOnboardingFlow } from '@automattic/onboarding';
import { useSelect } from '@wordpress/data';
import clsx from 'clsx';
Expand Down Expand Up @@ -32,6 +32,7 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
isOnboardingFlow( flow ) && isEnabled( 'onboarding/big-sky-before-plans' );

const translate = useTranslate();
const hasEnTranslation = useHasEnTranslation();
const { submit, goBack } = navigation;
const headerText = isGoalsFirstVariation
? translate( 'How would you like to start?' )
Expand Down Expand Up @@ -75,6 +76,28 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
submit?.( { destination } );
};

const getCreateWithAILabel = () => {
if ( hasEnTranslation( 'Create with AI {{small}}(BETA){{/small}}' ) ) {
return translate( 'Create with AI {{small}}(BETA){{/small}}', {
components: {
small: <span className="design-choices__beta-label" />,
},
} );
}

if ( hasEnTranslation( 'Create with AI' ) ) {
return translate( '%s {{small}}(BETA){{/small}}', {
args: [ translate( 'Create with AI' ) ],
components: {
small: <span className="design-choices__beta-label" />,
},
comment: 'Do not translate',
} );
}

return translate( 'Create with AI (BETA)' );
};

const bigSkyBadgeLabel =
! isLoading && isEligible && personalProduct?.cost_per_month_display && isGoalsFirstVariation
? translate( 'Starting at %(price)s a month', {
Expand Down Expand Up @@ -160,7 +183,8 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
) }
{ ! isLoading && isEligible && isGoalsFirstVariation && (
<GoalsFirstDesignChoice
title={ translate( 'Create with AI (BETA)' ) }
title={ getCreateWithAILabel() }
ariaLabel={ translate( 'Create with AI (BETA)' ) }
description={ translate(
'Use our AI website builder to easily and quickly build the site of your dreams.'
) }
Expand Down

0 comments on commit 2f163a6

Please sign in to comment.