Files
web/components/MyPages/Blocks/Benefits/NextLevel/index.tsx
2024-05-15 09:43:29 +02:00

66 lines
1.8 KiB
TypeScript

import Link from "next/link"
import { Lock } from "react-feather"
import { serverClient } from "@/lib/trpc/server"
import Button from "@/components/TempDesignSystem/Button"
import CardGrid from "@/components/TempDesignSystem/CardGrid"
import Title from "@/components/Title"
import styles from "./next.module.css"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function NextLevelBenefitsBlock({
title,
subtitle,
link,
}: AccountPageComponentProps) {
const { nextLevel, perks } = await serverClient().user.benefits.nextLevel()
return (
<section className={styles.container}>
<header className={styles.header}>
{title && (
<Title
as="h3"
level="h2"
uppercase
weight="medium"
className={styles.title}
>
{title}
</Title>
)}
{link && (
<Link className={styles.link} href={link.href}>
{link.text}
</Link>
)}
</header>
{subtitle && <p className={styles.subtitle}>{subtitle}</p>}
<CardGrid>
{perks.map((perk) => (
<article key={perk.id} className={styles.card}>
<Button type="button" intent="secondary" disabled>
<Lock height={16} />
Level up to unlock
</Button>
<div>
<span className={styles.level}>As our {nextLevel}</span>{" "}
<p className={styles.cardSubtitle}>{perk.explanation}</p>
</div>
</article>
))}
</CardGrid>
<div className={styles.buttonContainer}>
<Button intent="primary" asChild>
<Link href="#" className={styles.buttonText}>
Explore all levels and benefits
</Link>
</Button>
</div>
</section>
)
}