feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions
@@ -0,0 +1,12 @@
.card {
align-items: center;
background-color: var(--UI-Opacity-White-100);
border: 1px solid var(--Base-Border-Subtle);
border-radius: var(--Corner-radius-Medium);
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
justify-content: center;
min-height: 280px;
padding: var(--Spacing-x7) var(--Spacing-x3);
}
@@ -0,0 +1,58 @@
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { getProfile } from "@/lib/trpc/memoizedRequests"
import SectionContainer from "@/components/Section/Container"
import SectionHeader from "@/components/Section/Header"
import SectionLink from "@/components/Section/Link"
import Grids from "@/components/TempDesignSystem/Grids"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getLang } from "@/i18n/serverContext"
import { getMembershipLevelObject } from "@/utils/membershipLevel"
import styles from "./current.module.css"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function CurrentBenefitsBlock({
title,
subtitle,
link,
}: AccountPageComponentProps) {
const user = await getProfile()
// TAKE NOTE: we need clarification on how benefits stack from different levels
// in order to determine if a benefit is specific to a level or if it is a cumulative benefit
// we might have to add a new boolean property "exclusive" or similar
if (!user || "error" in user || !user.membership) {
return null
}
const currentLevel = getMembershipLevelObject(
user.membership.membershipLevel as MembershipLevelEnum,
getLang()
)
if (!currentLevel) {
// TODO: handle this case?
return null
}
return (
<SectionContainer>
<SectionHeader title={title} link={link} preamble={subtitle} />
<Grids.Stackable>
{currentLevel.benefits.map((benefit, idx) => (
<article className={styles.card} key={`${currentLevel}-${idx}`}>
<Title
as="h4"
level="h3"
textAlign="center"
textTransform="regular"
>
{benefit.title}
</Title>
</article>
))}
</Grids.Stackable>
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}