Skip to content

Commit 166d9e6

Browse files
authored
Shrink Big Sky beta label and make use of partial translations (#99145)
* Shrink Big Sky beta label * Fix typescript error
1 parent 5aa4499 commit 166d9e6

File tree

3 files changed

+69
-32
lines changed

3 files changed

+69
-32
lines changed

client/landing/stepper/declarative-flow/internals/steps-repository/design-choices/goals-first-design-choice.scss

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
font-weight: 500;
4747
line-height: 24px;
4848
text-align: left;
49+
50+
.design-choices__beta-label {
51+
font-size: $font-body-extra-small;
52+
font-weight: 600;
53+
line-height: 14px;
54+
text-align: left;
55+
}
4956
}
5057

5158
.goals-first-design-choice__description {

client/landing/stepper/declarative-flow/internals/steps-repository/design-choices/goals-first-design-choice.tsx

+36-30
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import './goals-first-design-choice.scss';
55

66
interface Props {
77
className?: string;
8-
title: string;
8+
title: string | number | React.ReactElement;
9+
ariaLabel?: string;
910
description: string;
1011
bgImageSrc?: string;
1112
fgImageSrc?: string;
@@ -17,44 +18,49 @@ interface Props {
1718
const GoalsFirstDesignChoice = ( {
1819
className,
1920
title,
21+
ariaLabel: _ariaLabel,
2022
description,
2123
bgImageSrc,
2224
fgImageSrc,
2325
destination,
2426
onSelect,
2527
badgeLabel,
26-
}: Props ) => (
27-
<button
28-
className={ clsx( 'goals-first-design-choice', className ) }
29-
aria-label={ title }
30-
onClick={ () => onSelect( destination ) }
31-
>
32-
<div className="goals-first-design-choice__content">
33-
<div className="goals-first-design-choice__background">
34-
{ badgeLabel && (
35-
<Badge type="info-blue" className="goals-first-design-choice__price-badge">
36-
{ badgeLabel }
37-
</Badge>
38-
) }
39-
<div className="goals-first-design-choice__background-item">
40-
{ bgImageSrc && <img src={ bgImageSrc } alt={ title } /> }
41-
{ fgImageSrc && (
42-
<img
43-
className="goals-first-design-choice__foreground-image"
44-
src={ fgImageSrc }
45-
alt={ title }
46-
/>
28+
}: Props ) => {
29+
const ariaLabel = ! _ariaLabel && typeof title === 'string' ? title : _ariaLabel;
30+
31+
return (
32+
<button
33+
className={ clsx( 'goals-first-design-choice', className ) }
34+
aria-label={ ariaLabel }
35+
onClick={ () => onSelect( destination ) }
36+
>
37+
<div className="goals-first-design-choice__content">
38+
<div className="goals-first-design-choice__background">
39+
{ badgeLabel && (
40+
<Badge type="info-blue" className="goals-first-design-choice__price-badge">
41+
{ badgeLabel }
42+
</Badge>
4743
) }
44+
<div className="goals-first-design-choice__background-item">
45+
{ bgImageSrc && <img src={ bgImageSrc } alt={ ariaLabel } /> }
46+
{ fgImageSrc && (
47+
<img
48+
className="goals-first-design-choice__foreground-image"
49+
src={ fgImageSrc }
50+
alt={ ariaLabel }
51+
/>
52+
) }
53+
</div>
4854
</div>
49-
</div>
50-
<div className="goals-first-design-choice__foreground">
51-
<div className="goals-first-design-choice__title">{ title }</div>
52-
<div className="goals-first-design-choice__description">
53-
{ preventWidows( description ) }
55+
<div className="goals-first-design-choice__foreground">
56+
<div className="goals-first-design-choice__title">{ title }</div>
57+
<div className="goals-first-design-choice__description">
58+
{ preventWidows( description ) }
59+
</div>
5460
</div>
5561
</div>
56-
</div>
57-
</button>
58-
);
62+
</button>
63+
);
64+
};
5965

6066
export default GoalsFirstDesignChoice;

client/landing/stepper/declarative-flow/internals/steps-repository/design-choices/index.tsx

+26-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { isEnabled } from '@automattic/calypso-config';
22
import { PLAN_PERSONAL } from '@automattic/calypso-products';
33
import { OnboardSelect, ProductsList } from '@automattic/data-stores';
44
import { themesIllustrationImage } from '@automattic/design-picker';
5-
import { localizeUrl } from '@automattic/i18n-utils';
5+
import { localizeUrl, useHasEnTranslation } from '@automattic/i18n-utils';
66
import { StepContainer, isOnboardingFlow } from '@automattic/onboarding';
77
import { useSelect } from '@wordpress/data';
88
import clsx from 'clsx';
@@ -32,6 +32,7 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
3232
isOnboardingFlow( flow ) && isEnabled( 'onboarding/big-sky-before-plans' );
3333

3434
const translate = useTranslate();
35+
const hasEnTranslation = useHasEnTranslation();
3536
const { submit, goBack } = navigation;
3637
const headerText = isGoalsFirstVariation
3738
? translate( 'How would you like to start?' )
@@ -75,6 +76,28 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
7576
submit?.( { destination } );
7677
};
7778

79+
const getCreateWithAILabel = () => {
80+
if ( hasEnTranslation( 'Create with AI {{small}}(BETA){{/small}}' ) ) {
81+
return translate( 'Create with AI {{small}}(BETA){{/small}}', {
82+
components: {
83+
small: <span className="design-choices__beta-label" />,
84+
},
85+
} );
86+
}
87+
88+
if ( hasEnTranslation( 'Create with AI' ) ) {
89+
return translate( '%s {{small}}(BETA){{/small}}', {
90+
args: [ translate( 'Create with AI' ) ],
91+
components: {
92+
small: <span className="design-choices__beta-label" />,
93+
},
94+
comment: 'Do not translate',
95+
} );
96+
}
97+
98+
return translate( 'Create with AI (BETA)' );
99+
};
100+
78101
const bigSkyBadgeLabel =
79102
! isLoading && isEligible && personalProduct?.cost_per_month_display && isGoalsFirstVariation
80103
? translate( 'Starting at %(price)s a month', {
@@ -160,7 +183,8 @@ const DesignChoicesStep: Step = ( { navigation, flow, stepName } ) => {
160183
) }
161184
{ ! isLoading && isEligible && isGoalsFirstVariation && (
162185
<GoalsFirstDesignChoice
163-
title={ translate( 'Create with AI (BETA)' ) }
186+
title={ getCreateWithAILabel() }
187+
ariaLabel={ translate( 'Create with AI (BETA)' ) }
164188
description={ translate(
165189
'Use our AI website builder to easily and quickly build the site of your dreams.'
166190
) }

0 commit comments

Comments
 (0)