Skip to content

Commit 3df5649

Browse files
authored
feat: add $250 credit message to upgrade button (#4447)
1 parent 2afeb32 commit 3df5649

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

src/cloud/components/RateLimitAlertContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const UpgradeContent: FC<UpgradeProps> = ({
9393
<UpgradeMessage {...{limitText, link, type}} />
9494
<CloudUpgradeButton
9595
className="upgrade-payg--button__rate-alert"
96+
showPromoMessage={false}
9697
metric={() => event(`user.limits.${type}.upgrade`, {location})}
9798
/>
9899
</FlexBox>

src/shared/components/CloudUpgradeButton.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ import CloudOnly from 'src/shared/components/cloud/CloudOnly'
1515

1616
// Utils
1717
import {shouldShowUpgradeButton} from 'src/me/selectors'
18+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
1819

1920
interface OwnProps {
20-
className?: string
2121
buttonText?: string
22-
size?: ComponentSize
22+
className?: string
2323
metric?: () => void
24+
showPromoMessage?: boolean
25+
size?: ComponentSize
2426
}
2527

2628
const CloudUpgradeButton: FC<OwnProps> = ({
27-
size = ComponentSize.Small,
28-
className,
2929
buttonText = 'Upgrade Now',
30+
className,
3031
metric,
32+
showPromoMessage = true,
33+
size = ComponentSize.Small,
3134
}) => {
3235
const showUpgradeButton = useSelector(shouldShowUpgradeButton)
3336

@@ -44,22 +47,28 @@ const CloudUpgradeButton: FC<OwnProps> = ({
4447
history.push('/checkout')
4548
}
4649

50+
const promoMessage =
51+
isFlagEnabled('credit250Experiment') && showPromoMessage ? (
52+
<span className="credit-250-experiment-upgrade-button--text">
53+
Get $250 free credit
54+
</span>
55+
) : null
56+
4757
return (
4858
<CloudOnly>
4959
{showUpgradeButton && (
50-
<Button
51-
icon={IconFont.CrownSolid_New}
52-
className={cloudUpgradeButtonClass}
53-
size={size}
54-
shape={ButtonShape.Default}
55-
onClick={handleClick}
56-
text={buttonText}
57-
style={{
58-
background:
59-
'linear-gradient(45deg, rgb(52, 187, 85) 0%, rgb(0, 163, 255) 100%)',
60-
}}
61-
testID="cloud-upgrade--button"
62-
/>
60+
<span>
61+
{promoMessage}
62+
<Button
63+
icon={IconFont.CrownSolid_New}
64+
className={cloudUpgradeButtonClass}
65+
size={size}
66+
shape={ButtonShape.Default}
67+
onClick={handleClick}
68+
text={buttonText}
69+
testID="cloud-upgrade--button"
70+
/>
71+
</span>
6372
)}
6473
</CloudOnly>
6574
)

src/shared/components/cloud/CloudOnly.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ a.upgrade-payg--button {
9191
background-image: url('~assets/images/dashboard-empty--dark.svg');
9292
}
9393

94+
button.upgrade-payg--button {
95+
background: linear-gradient(
96+
45deg,
97+
rgb(52, 187, 85) 0%,
98+
rgb(0, 163, 255) 100%
99+
);
100+
}
101+
102+
.credit-250-experiment-upgrade-button--text {
103+
margin: $cf-marg-c;
104+
}
105+
94106
@media screen and (min-width: $cf-nav-menu--breakpoint) {
95107
.rate-alert {
96108
margin-left: $cf-space-l;

0 commit comments

Comments
 (0)