feat(WEB-304): remaning UI from design system primitives

This commit is contained in:
Simon Emanuelsson
2024-06-07 10:36:23 +02:00
parent 6737970f54
commit 7c4b8401e9
228 changed files with 3516 additions and 3237 deletions

View File

@@ -1,45 +1,21 @@
.container {
display: grid;
gap: 1.5rem;
gap: var(--Spacing-x7);
}
.script {
transform: rotate(-2deg);
}
.card {
display: flex;
flex: 1 1 0px;
flex-direction: column;
align-items: center;
background-color: var(--UI-Grey-10);
border-radius: var(--Corner-radius-Small);
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
justify-content: center;
gap: var(--Spacing-x2);
padding: var(--Spacing-x7) var(--Spacing-x3);
min-height: 280px;
background-color: var(--Scandic-Beige-00);
border-radius: var(--Corner-radius-Medium);
border: 1px solid var(--Scandic-Beige-20);
text-decoration: none;
text-align: center;
color: var(--Theme-Primary-Light-On-Surface-Text);
}
.title {
display: flex;
flex-direction: column;
text-wrap: balance;
}
.titleValue {
color: var(--UI-Red-60);
}
.titleExplanation {
color: var(--Theme-Primary-Light-On-Surface-Text);
}
.subtitle {
color: var(--Theme-Primary-Light-On-Surface-Text);
font-family: var(--typography-Body-Regular-fontFamily);
font-size: 16px;
font-weight: 400;
line-height: 150%;
letter-spacing: 0.096px;
text-align: center;
margin: 0;
padding: var(--Spacing-x3);
}

View File

@@ -1,13 +1,11 @@
import { Lang } from "@/constants/languages"
import { serverClient } from "@/lib/trpc/server"
import Header from "@/components/MyPages/Blocks/Header"
import CardGrid from "@/components/TempDesignSystem/CardGrid"
import Grids from "@/components/TempDesignSystem/Grids"
import Link from "@/components/TempDesignSystem/Link"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Title from "@/components/TempDesignSystem/Text/Title"
import levelsData from "../data"
import { getIntl } from "@/i18n"
import styles from "./current.module.css"
@@ -19,45 +17,36 @@ export default async function CurrentBenefitsBlock({
link,
}: AccountPageComponentProps) {
const user = await serverClient().user.get()
const { formatMessage } = await getIntl()
// TODO: level should be fetched from the `user` object once available
// 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
const userLevel = 1
const currentLevel = levelsData[Lang.en].levels.find(
(level) => level.tier === userLevel
)
if (!currentLevel) {
// TODO: handle this case?
return null
}
const currentLevel = Array.of(...Array(3).keys())
return (
<section className={styles.container}>
<Header title={title} link={link} subtitle={subtitle} />
<CardGrid isMobileCarousel={true}>
{currentLevel.benefits.map((benefit, idx) => (
<Link
href={benefit.href}
key={`${currentLevel}-${idx}`}
className={styles.card}
>
<Title as="h5" level="h3" className={styles.title}>
<span className={styles.titleValue}>{benefit.value}</span>
{benefit.explaination ? (
<span className={styles.titleExplanation}>
{benefit.explaination}
</span>
) : null}
<Grids.Scrollable>
{currentLevel.map((benefit) => (
<Link className={styles.card} href="#" key={benefit}>
<BiroScript
className={styles.script}
color="primaryLightOnSurfaceAccent"
type="two"
>
{formatMessage({ id: "As our Close Friend" })}
</BiroScript>
<Title as="h5" level="h3" textAlign="center">
{formatMessage({
id: "Free soft drink voucher for the kids when staying",
})}
</Title>
<Subtitle className={styles.subtitle}>
{benefit.description}
</Subtitle>
</Link>
))}
</CardGrid>
</Grids.Scrollable>
</section>
)
}

View File

@@ -4,8 +4,11 @@ import { serverClient } from "@/lib/trpc/server"
import Header from "@/components/MyPages/Blocks/Header"
import Button from "@/components/TempDesignSystem/Button"
import CardGrid from "@/components/TempDesignSystem/CardGrid"
import Chip from "@/components/TempDesignSystem/Chip"
import Grids from "@/components/TempDesignSystem/Grids"
import Link from "@/components/TempDesignSystem/Link"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import { getIntl } from "@/i18n"
import styles from "./next.module.css"
@@ -22,35 +25,34 @@ export default async function NextLevelBenefitsBlock({
return (
<section className={styles.container}>
<Header title={title} subtitle={subtitle} link={link} />
<CardGrid variant="twoColumnGrid">
<Grids.Stackable>
{perks.map((perk) => (
<article key={perk.id} className={styles.card}>
<div className={styles.cardInner}>
{/*TODO: These label buttons will be rebuilt as "Chip" (Badge?) components according to design.*/}
<Button
type="button"
size="small"
className={styles.chip}
disabled
<Chip>
<Lock height={16} />
{formatMessage({ id: "Level up to unlock" })}
</Chip>
<div>
<BiroScript
className={styles.level}
color="primaryLightOnSurfaceAccent"
textAlign="center"
type="two"
>
<Lock height={16} />
Level up to unlock
</Button>
<div className={styles.mainContentContainer}>
<span className={styles.level}>As our {nextLevel}</span>{" "}
<p className={styles.cardSubtitle}>{perk.explanation}</p>
</div>
{formatMessage({ id: "As our" })} {nextLevel}
</BiroScript>{" "}
<Subtitle color="pale" textAlign="center">
{perk.explanation}
</Subtitle>
</div>
</article>
))}
</CardGrid>
<div className={styles.buttonContainer}>
<Button asChild intent="primary">
<Link href="#">
{formatMessage({ id: "Explore all levels and benefits" })}
</Link>
</Button>
</div>
</Grids.Stackable>
<Button asChild intent="primary">
<Link className={styles.link} href="#">
{formatMessage({ id: "Explore all levels and benefits" })}
</Link>
</Button>
</section>
)
}

View File

@@ -1,104 +1,23 @@
.container {
display: grid;
gap: 1.5rem;
}
.cardContainer {
display: grid;
gap: 0.4rem;
}
.title {
font-weight: 600;
}
.subtitle {
margin: 0;
font-size: 2rem;
gap: var(--Spacing-x7);
}
.card {
text-decoration: none;
display: flex;
flex-direction: column;
flex: 1 0 0;
align-self: stretch;
border-radius: var(--Corner-radius-Medium);
align-items: center;
background-color: var(--Scandic-Brand-Burgundy);
text-align: center;
}
.cardInner {
border-radius: var(--Corner-radius-Small);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: var(--Spacing-x3) var(--Spacing-x3) var(--Spacing-x7);
gap: var(--Spacing-x2);
align-self: stretch;
}
.mainContentContainer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: var(--Spacing-x1);
align-self: stretch;
}
/* TODO: Remove once we have the "Chip" (badge?) component. */
.chip {
background-color: var(--Scandic-Red-90) !important;
color: var(--Scandic-Peach-50) !important;
padding: var(--Spacing-x-half) var(--Spacing-x1) !important;
font-size: 12px !important;
height: 22px !important;
padding: var(--Spacing-x3) var(--Spacing-x3) var(--Spacing-x7);
}
.level {
text-align: center;
font-family: var(--typography-Script-2-fontFamily);
font-size: var(--typography-Script-2-Mobile-fontSize);
font-weight: var(--typography-Script-2-fontWeight);
line-height: var(--typography-Script-2-lineHeight);
letter-spacing: 0.4px;
color: var(--Scandic-Peach-50);
transform: rotate(-2deg);
}
.cardSubtitle {
color: var(--Scandic-Brand-Pale-Peach);
font-family: var(--typography-Title-5-fontFamily);
font-size: var(--typography-Title-5-Mobile-fontSize);
font-weight: 500;
line-height: var(--typography-Title-5-lineHeight);
/* TODO: I presume the actual text-transform value should be: var(--typography-Title-5-textCase);
* - verify why we return "upper" and not uppercase.
* */
margin: 0;
text-transform: uppercase;
text-wrap: balance;
}
.buttonContainer {
display: flex;
justify-content: center;
}
@media screen and (min-width: 950px) {
.cardContainer {
grid-template-columns: 1fr 1fr 1fr;
}
.level {
font-size: var(--typography-Script-2-Desktop-fontSize);
letter-spacing: 0.48px;
}
.cardSubtitle {
font-size: var(--typography-Title-5-fontSize);
}
.level {
font-size: var(--typography-Script-2-fontSize);
}
}
.link {
justify-self: center;
}