Skip to content

Commit fe1efbf

Browse files
feat: default billed yearly
1 parent a42f484 commit fe1efbf

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

src/components/subscription/PricingModal.jsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function PricingModal({
1010
loginHandler,
1111
onSubscriptionChange,
1212
}) {
13-
const [isMonthlyType, setIsMonthlyType] = useState(true);
13+
const [isMonthlyType, setIsMonthlyType] = useState(false);
1414
const monthlyBillingClicked = (e) => {
1515
setIsMonthlyType(true);
1616
};
@@ -41,7 +41,7 @@ export function PricingModal({
4141
onClick={yearlyBillingClicked}
4242
class={`${isMonthlyType ? '' : 'bg-black'} ml-0.5 relative border border-transparent rounded-md py-2 w-1/2 text-xs whitespace-nowrap focus:outline-none sm:w-auto sm:px-8`}
4343
>
44-
Yearly{' '}
44+
Billed Yearly{' '}
4545
<span
4646
className={`${isMonthlyType ? '' : 'text-green-500'}`}
4747
>
@@ -57,7 +57,9 @@ export function PricingModal({
5757
<SubscriptionItem
5858
planName="Starter"
5959
planType="free"
60-
priceDesc="Free"
60+
price="Free"
61+
priceDesc="Free for everyone"
62+
priceSaveDesc={isMonthlyType ? '' : ' '}
6163
upgradeBtnName={
6264
userService.getPlanType() == 'free'
6365
? 'Current plan'
@@ -75,8 +77,10 @@ export function PricingModal({
7577
/>
7678
<SubscriptionItem
7779
planName="Basic"
78-
priceDesc={isMonthlyType ? '$4.99' : '$0.83'}
80+
price={isMonthlyType ? '$4.99' : '$0.83'}
7981
priceTerm="/month"
82+
priceDesc={isMonthlyType ? ' ' : 'Billed yearly'}
83+
priceSaveDesc={isMonthlyType ? '' : 'Save 49.92 USD'}
8084
planType={isMonthlyType ? 'basic-monthly' : 'basic-yearly'}
8185
upgradeBtnName="Upgrade to Basic"
8286
preActionCallback={onClose}
@@ -88,9 +92,11 @@ export function PricingModal({
8892
/>
8993
<SubscriptionItem
9094
planName="Plus"
91-
priceDesc={isMonthlyType ? '$7.99' : '$1.25'}
95+
price={isMonthlyType ? '$7.99' : '$1.25'}
9296
priceTerm="/month"
9397
planType={isMonthlyType ? 'plus-monthly' : 'plus-yearly'}
98+
priceDesc={isMonthlyType ? ' ' : 'Billed yearly'}
99+
priceSaveDesc={isMonthlyType ? '' : 'Save 80.88 USD'}
94100
upgradeBtnName="Upgrade to Plus"
95101
preActionCallback={onClose}
96102
loginCallback={loginHandler}
@@ -104,8 +110,10 @@ export function PricingModal({
104110
/>
105111
<SubscriptionItem
106112
planName="Enterprise"
107-
priceDesc="-"
113+
price="Custom"
108114
planType="enterprise"
115+
priceDesc=" "
116+
priceSaveDesc={isMonthlyType ? '' : ' '}
109117
upgradeBtnName="Contact us"
110118
preActionCallback={onClose}
111119
loginCallback={loginHandler}

src/components/subscription/SubscriptionItem.jsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,28 @@ export function SubscriptionItem(props) {
1616
<div class="p-3">
1717
<h2 class="text-xs font-semibold leading-6">{props.planName}</h2>
1818
<p class="mt-1">
19-
{props.priceDesc && (
20-
<span class="text-2xl font-semibold">{props.priceDesc}</span>
19+
{props.price && (
20+
<span class="text-2xl font-semibold">{props.price}</span>
2121
)}
2222
{props.priceTerm && <span class="text-base">{props.priceTerm}</span>}
2323
</p>
24+
<div>
25+
{props.priceDesc && props.priceDesc != ' ' && (
26+
<p class="mt-2 text-xs font-semibold">{props.priceDesc}</p>
27+
)}
28+
{props.priceDesc && props.priceDesc == ' ' && (
29+
<p class="invisible mt-2 text-xs font-semibold">&nbsp;</p>
30+
)}
31+
32+
{props.priceSaveDesc && props.priceSaveDesc != ' ' && (
33+
<p class="text-green-500 text-xs font-semibold">
34+
{props.priceSaveDesc}
35+
</p>
36+
)}
37+
{props.priceSaveDesc && props.priceSaveDesc == ' ' && (
38+
<p class="invisible text-xs font-semibold">&nbsp;</p>
39+
)}
40+
</div>
2441
{props.planName != 'Enterprise' && featureToggle.isPaymentEnabled && (
2542
<SubscriptionAction
2643
planType={props.planType}

0 commit comments

Comments
 (0)