Skip to content

Commit d11e4a0

Browse files
committed
feat: enhance small pricing section
1 parent 2a5ce63 commit d11e4a0

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/components/sections/SmallPricingSection.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ interface SmallPricingSectionProps {
1717
content?: SmallPricingLayoutBlock | null
1818
locale: AppLocale
1919
packages: SubscriptionConfigData["packages"]
20+
paymentPeriod: SubscriptionConfigData["paymentPeriod"]
2021
}
2122

22-
export function SmallPricingSection({ content, locale, packages }: SmallPricingSectionProps) {
23+
export function SmallPricingSection({ content, locale, packages, paymentPeriod }: SmallPricingSectionProps) {
2324
if (!content) return null
2425

2526
const selectedPeriod = content.pricingPeriod
2627
const periodMonths = selectedPeriod === "quarterly" ? 3 : selectedPeriod === "yearly" ? 12 : 1
2728
const periodSuffix = {
28-
monthly: "/mo",
29-
quarterly: "/qtr",
30-
yearly: "/yr",
29+
monthly: paymentPeriod.monthlyPeriodSuffix,
30+
quarterly: paymentPeriod.quarterlyPeriodSuffix,
31+
yearly: paymentPeriod.yearlyPeriodSuffix,
3132
}[selectedPeriod]
3233
const pricingPackages = [
3334
{
@@ -72,10 +73,7 @@ export function SmallPricingSection({ content, locale, packages }: SmallPricingS
7273
animation={{ preset: "none" }}
7374
>
7475
<Card size="lg" variant="light" radialGradient={content.gradient} gradientDirection={content.gradientDirection} className="mx-auto w-full max-w-5xl p-2!">
75-
<div
76-
aria-hidden="true"
77-
className="pointer-events-none absolute inset-y-0 left-1/3 hidden w-1/3 bg-[radial-gradient(ellipse_at_top,oklch(1_0_0/0.1),transparent_68%)] md:block"
78-
/>
76+
<div aria-hidden="true" className="pointer-events-none absolute inset-y-0 left-1/3 hidden w-1/3 bg-[radial-gradient(ellipse_at_top,oklch(1_0_0/0.1),transparent_68%)] md:block" />
7977
<StaggerContainer className="relative z-10 grid grid-cols-1 md:grid-cols-3" delayChildren={0.04} staggerChildren={0.08}>
8078
{pricingPackages.map((pricingPackage) => {
8179
const features = pricingPackage.content?.features?.filter((feature) => Boolean(feature.text)) ?? []
@@ -90,9 +88,14 @@ export function SmallPricingSection({ content, locale, packages }: SmallPricingS
9088

9189
return (
9290
<StaggerItem key={pricingPackage.key} y={10} duration={0.36} className="relative flex min-w-0 flex-col overflow-hidden p-5 sm:p-6">
93-
{highlighted && <div aria-hidden="true" className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,oklch(1_0_0/0.1),transparent_68%)] md:hidden" />}
91+
{highlighted && (
92+
<div aria-hidden="true" className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,oklch(1_0_0/0.1),transparent_68%)] md:hidden" />
93+
)}
9494
<div className="flex items-start justify-between gap-2">
95-
<h3 className="text-xl font-semibold text-white">{pricingPackage.title}</h3>
95+
<div className="min-w-0">
96+
<h3 className="text-xl font-semibold text-white">{pricingPackage.title}</h3>
97+
{pricingPackage.description && <p className="text-sm leading-5 text-secondary">{pricingPackage.description}</p>}
98+
</div>
9699
{discount > 0 && (
97100
<StableBadge border className="shrink-0 border-brand/25! bg-brand/15! px-2 py-1 text-xs font-semibold tracking-wider text-brand!">
98101
-{discount}%
@@ -108,13 +111,12 @@ export function SmallPricingSection({ content, locale, packages }: SmallPricingS
108111
format={{ style: "currency", currency: "EUR", trailingZeroDisplay: "stripIfInteger" }}
109112
className="text-3xl font-semibold text-white"
110113
/>
111-
<span className="text-lg font-semibold text-tertiary">{periodSuffix}</span>
114+
<span className="text-base text-tertiary">{periodSuffix}</span>
112115
</div>
113116
)}
114-
{pricingPackage.description && <p className="text-sm leading-5 text-secondary">{pricingPackage.description}</p>}
115117

116118
{(features.length > 0 || missingFeatures.length > 0) && (
117-
<ul className="mt-6 flex flex-col gap-1.5">
119+
<ul className="mt-4 flex flex-col gap-1.5">
118120
{features.map((feature, featureIndex) => (
119121
<li key={feature.id ?? `feature-${featureIndex}`} className="flex items-start gap-2 text-sm text-white">
120122
<IconCheck size={16} className="mt-0.5 shrink-0 text-brand" />

src/components/ui/PageBlockRenderer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ const pageBlockRenderers: Partial<Record<PageBlock["blockType"], BlockRenderer>>
183183
const config = options.subscriptionConfig
184184
if (!config?.packages) return null
185185

186-
return <SmallPricingSection content={block as Extract<PageBlock, { blockType: "smallPricing" }>} locale={options.locale ?? "en"} packages={config.packages} />
186+
return (
187+
<SmallPricingSection content={block as Extract<PageBlock, { blockType: "smallPricing" }>} locale={options.locale ?? "en"} packages={config.packages} paymentPeriod={config.paymentPeriod} />
188+
)
187189
},
188190
contact: (block, options) => <ContactSection content={block as Extract<PageBlock, { blockType: "contact" }>} locale={options.locale ?? "en"} />,
189191
compareApplication: (block) => <CompareApplicationSection content={block as Extract<PageBlock, { blockType: "compareApplication" }>} />,

0 commit comments

Comments
 (0)