Skip to content

Commit 830a3ec

Browse files
authored
Fix hardcore purchase button responsive design (#71)
1 parent a16f5cf commit 830a3ec

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

packages/classic-webview/src/components/PurchaseButton.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ interface PurchaseButtonProps {
88
style: 'primary' | 'secondary';
99
price: number;
1010
productSku: 'hardcore-mode-lifetime-access' | 'hardcore-mode-seven-day-access';
11+
shortText: string;
1112
}
1213

1314
export const PurchaseButton: React.FC<PurchaseButtonProps> = (props) => {
14-
const { children, price, productSku, style } = props;
15+
const { children, price, productSku, style, shortText } = props;
1516

1617
const onClick = () => {
1718
sendMessageToDevvit({
@@ -26,21 +27,22 @@ export const PurchaseButton: React.FC<PurchaseButtonProps> = (props) => {
2627
<button
2728
onClick={onClick}
2829
className={cn(
29-
'flex w-full cursor-pointer flex-row items-center justify-between gap-4 whitespace-nowrap rounded-full border-2 border-current px-6 py-3 text-center font-sans font-semibold sm:w-auto',
30+
'flex w-full min-w-0 cursor-pointer flex-row items-center justify-between gap-4 rounded-full border-2 border-current p-3 text-center font-sans font-semibold sm:w-auto sm:px-6',
3031
style === 'primary' ? 'text-mustard-gold' : 'text-slate-gray'
3132
)}
3233
>
33-
<span className="text-left text-base">{children}</span>
34+
<span className="xs:block hidden truncate text-left text-base">{children}</span>
35+
<span className="xs:hidden block text-left text-base">{shortText}</span>
3436
<span
3537
className={cn(
36-
'flex w-fit flex-row items-center gap-[6px] rounded-full px-3 py-2 text-xs',
38+
'flex flex-none flex-row items-center gap-1 rounded-full p-2 text-xs sm:gap-[6px] sm:px-3',
3739
style === 'primary' ? 'bg-mustard-gold text-black' : 'bg-charcoal text-white'
3840
)}
3941
>
4042
<span className="flex h-4 w-4 items-center justify-center">
4143
<GoldIcon />
4244
</span>
43-
Use {price}
45+
<span className="whitespace-nowrap">Use {price}</span>
4446
</span>
4547
</button>
4648
);

packages/classic-webview/src/components/UnlockHardcoreCTAContent.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@ export const UnlockHardcoreCTAContent = ({
1313
return (
1414
<div className="flex w-full max-w-md flex-col items-center justify-center gap-4 p-6 sm:gap-6 sm:p-8 md:max-w-2xl md:p-10">
1515
{withLogo && <HardcoreLogo />}
16-
<p className="text-xl font-bold text-white sm:text-2xl">100 guesses. No hints. No mercy.</p>
17-
<p className="text-sm font-normal text-gray-300">Get access to expert-level puzzles</p>
16+
<p className="text-center text-xl font-bold text-white sm:text-2xl">
17+
100 guesses. No hints. No mercy.
18+
</p>
19+
<p className="text-center text-sm font-normal text-gray-300">
20+
Unlocking Hardcore grants access to today and all previous hardcore puzzles.
21+
</p>
1822
<hr className="h-px w-1/2 max-w-xs bg-white/20"></hr>
19-
<div className="flex w-full flex-col items-center gap-4 py-2 sm:w-auto sm:flex-row sm:items-start">
20-
<PurchaseButton price={50} style="secondary" productSku="hardcore-mode-seven-day-access">
23+
<div className="flex w-full flex-col items-center gap-4 py-2 sm:flex-row sm:flex-wrap sm:justify-center">
24+
<PurchaseButton
25+
price={50}
26+
style="secondary"
27+
productSku="hardcore-mode-seven-day-access"
28+
shortText="7 Days"
29+
>
2130
Unlock for 7 days
2231
</PurchaseButton>
23-
<PurchaseButton price={250} style="primary" productSku="hardcore-mode-lifetime-access">
32+
<PurchaseButton
33+
price={250}
34+
style="primary"
35+
productSku="hardcore-mode-lifetime-access"
36+
shortText="FOREVER"
37+
>
2438
Unlock FOREVER
2539
</PurchaseButton>
2640
</div>

0 commit comments

Comments
 (0)