Skip to content

Commit

Permalink
feat: Better pricing wording
Browse files Browse the repository at this point in the history
  • Loading branch information
storm1729 committed Dec 28, 2024
1 parent d0a83be commit 42d7ae6
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 131 deletions.
4 changes: 0 additions & 4 deletions src/app/[lang]/pricing/Card.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
padding-top: 24px !important;
}

.icon {
margin-right: 16px;
}

.mo {
font-size: 1.25rem;
}
40 changes: 3 additions & 37 deletions src/app/[lang]/pricing/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Card as GCard, Divider, Spacer, Text } from "@geist-ui/react";
import Check from "@geist-ui/react-icons/check";
import React from "react";

import styles from "./Card.module.css";
import { Dictionary } from "@/dictionaries";

export interface CardProps extends React.HTMLProps<HTMLDivElement> {
d: Dictionary;
body?: React.ReactElement;
cta?: React.ReactElement;
extra?: React.ReactElement;
features?: (string | React.ReactElement)[];
features?: React.ReactElement[];
header?: string | React.ReactElement;
price?: string | React.ReactElement;
subtitle?: React.ReactElement;
Expand All @@ -19,17 +16,7 @@ export interface CardProps extends React.HTMLProps<HTMLDivElement> {
}

export function Card(props: CardProps): React.ReactElement {
const {
cta,
header,
features,
extra,
price,
title,
subtitle,
body,
footer,
} = props;
const { cta, header, features, price, title, subtitle, footer } = props;
const d = props.d.pricing;

return (
Expand Down Expand Up @@ -59,29 +46,8 @@ export function Card(props: CardProps): React.ReactElement {
<Divider />
<Spacer />

{extra}
{features}

<div>
<Text b small>
{d.cards.what_you_get}
</Text>
<Spacer />
{features?.map((f, i) => (
<div key={i}>
<div className="flex align-center">
<div>
<Check className={styles.icon} width={24} />
</div>
<Text small>{f}</Text>
</div>
<Spacer h={0.5} />
</div>
))}
</div>

{body}

{footer && <Divider />}
{footer && <div>{footer}</div>}
</GCard>
);
Expand Down
71 changes: 24 additions & 47 deletions src/app/[lang]/pricing/Commercial.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react";
import { Check, Info } from "@geist-ui/react-icons";
import { ProductCard, ProductCardProps } from "./ProductCard";
import { Spacer, Text } from "@geist-ui/react";
import styles from "./Card.module.css";
import { Text } from "@geist-ui/react";
import Markdown from "marked-react";
import { SpanRenderer } from "@/components/Markdown";
import { Features } from "./Features";

export function Commercial(
props: Omit<ProductCardProps, "title">
Expand All @@ -14,52 +13,30 @@ export function Commercial(
return (
<ProductCard
{...props}
extra={
<div>
<Text b small>
{d.what_need_to_do}
</Text>
<Spacer />
<div className="flex align-center">
<div>
<Check className={styles.icon} width={24} />
</div>
<Text small>
<Markdown renderer={SpanRenderer}>
{d.purchase_server}
</Markdown>
</Text>
</div>
<Spacer />
</div>
}
features={[
<Markdown renderer={SpanRenderer} key="licenseFeatures-3">
{d.unlimited_emails}
</Markdown>,
<Markdown renderer={SpanRenderer} key="licenseFeatures-1">
{d.bulk}
</Markdown>,
d.no_data_reacher,
<Markdown renderer={SpanRenderer} key="licenseFeatures-4">
{d.support}
</Markdown>,
<Markdown renderer={SpanRenderer} key="licenseFeatures-6">
{d.terms}
</Markdown>,
<Features
key="what-needs-to-do"
title={d.what_need_to_do}
features={[d.purchase_server]}
/>,
<Features
key="what-you-get"
title={d.what_you_get}
features={[
d.unlimited_emails,
d.bulk,
d.no_data_reacher,
d.support,
d.terms,
]}
/>,
<Features
key="commercial-license-trial"
title={d.free_trial}
features={[d["10k_per_day"], d.proxy, d.data_shared]}
/>,
]}
footer={
<div className="flex">
<div>
<Info className={styles.icon} width={24} />
</div>
<Text small>
<Markdown renderer={SpanRenderer}>
{d.free_trial}
</Markdown>
</Text>
</div>
}
ctaInFooter
header={
<Text b small type="success">
{d.overtitle}
Expand Down
3 changes: 3 additions & 0 deletions src/app/[lang]/pricing/Features.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.icon {
margin-right: 16px;
}
38 changes: 38 additions & 0 deletions src/app/[lang]/pricing/Features.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Spacer, Text } from "@geist-ui/react";
import React from "react";

import styles from "./Features.module.css";
import { Check } from "@geist-ui/react-icons";
import Markdown from "marked-react";
import { SpanRenderer } from "@/components/Markdown";

export function Features({
features,
title,
}: {
features: string[];
title: string;
}) {
return (
<>
<Text b small>
{title}
</Text>
<Spacer />
{features?.map((f, i) => (
<div key={i}>
<div className="flex align-center">
<div className={styles.icon}>
<Check width={24} />
</div>
<Text small>
<Markdown renderer={SpanRenderer}>{f}</Markdown>
</Text>
</div>
<Spacer h={0.5} />
</div>
))}
<Spacer />
</>
);
}
12 changes: 8 additions & 4 deletions src/app/[lang]/pricing/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import { DLink } from "@/components/DLink";

export interface ProductCardProps {
d: Dictionary;
ctaInFooter?: boolean;
currency: string;
isLoggedIn: boolean;
product: ProductWithPrice;
subscription: Tables<"subscriptions"> | null;
extra?: React.ReactElement;
header?: React.ReactElement;
footer?: React.ReactElement;
features?: (string | React.ReactElement)[];
features?: React.ReactElement[];
subtitle?: React.ReactElement;
ctaLabel: string;
}
Expand All @@ -31,6 +32,8 @@ export function ProductCard({
product,
subscription,
ctaLabel,
ctaInFooter,
footer,
...props
}: ProductCardProps): React.ReactElement {
const [priceIdLoading, setPriceIdLoading] = useState<string | false>();
Expand Down Expand Up @@ -81,7 +84,7 @@ export function ProductCard({
minimumFractionDigits: 0,
}).format(price.unit_amount / 100);

const b = (
const ctaButton = (
<Button
className="full-width"
disabled={!!priceIdLoading || active}
Expand Down Expand Up @@ -114,10 +117,10 @@ export function ProductCard({
<Card
cta={
isLoggedIn ? (
b
ctaButton
) : (
<DLink d={props.d} href="/signup" className="full-width">
{b}
{ctaButton}
</DLink>
)
}
Expand All @@ -128,6 +131,7 @@ export function ProductCard({
product.name ||
"No Product"
} // The latter should never happen
footer={footer ? footer : ctaInFooter ? ctaButton : undefined}
{...props}
/>
);
Expand Down
32 changes: 13 additions & 19 deletions src/app/[lang]/pricing/SaaS100k.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from "react";
import { Text } from "@geist-ui/react";
import { ProductCard } from "./ProductCard";
import type { ProductCardProps } from "./ProductCard";
import Markdown from "marked-react";
import { SpanRenderer } from "@/components/Markdown";
import { ENABLE_BULK } from "@/util/helpers";
import { Features } from "./Features";

export function SaaS100k(
props: Omit<ProductCardProps, "title">
Expand All @@ -20,22 +18,18 @@ export function SaaS100k(
</Text>
}
features={[
ENABLE_BULK ? (
<Markdown renderer={SpanRenderer} key="licenseFeatures-1">
{d.bulk}
</Markdown>
) : (
""
),
d.reacher_ip,
<Markdown renderer={SpanRenderer} key="saasFeatures-2">
{d.full_feature}
</Markdown>,
<Markdown renderer={SpanRenderer} key="customer-support">
{d.support}
</Markdown>,
d.cancel,
].filter((x) => !!x)}
<Features
key="what-you-get"
title={d.what_you_get}
features={[
d.bulk,
d.reacher_ip,
d.full_feature,
d.support,
d.cancel,
]}
/>,
]}
subtitle={<span>{d.subtitle}</span>}
/>
);
Expand Down
21 changes: 11 additions & 10 deletions src/app/[lang]/pricing/SaaS10k.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from "react";
import { Text } from "@geist-ui/react";
import { ProductCard } from "./ProductCard";
import type { ProductCardProps } from "./ProductCard";
import Markdown from "marked-react";
import { SpanRenderer } from "@/components/Markdown";
import { Features } from "./Features";

export function SaaS10k(
props: Omit<ProductCardProps, "title">
Expand All @@ -19,14 +18,16 @@ export function SaaS10k(
</Text>
}
features={[
d.reacher_ip,
<Markdown renderer={SpanRenderer} key="saasFeatures-2">
{d.full_feature}
</Markdown>,
<Markdown renderer={SpanRenderer} key="customer-support">
{d.support}
</Markdown>,
d.cancel,
<Features
key="what-you-get"
title={d.what_you_get}
features={[
d.reacher_ip,
d.full_feature,
d.support,
d.cancel,
]}
/>,
]}
subtitle={<span>{d.subtitle}</span>}
/>
Expand Down
Loading

0 comments on commit 42d7ae6

Please sign in to comment.