diff --git a/components/Loyalty/Blocks/CardsGrid/index.tsx b/components/Loyalty/Blocks/CardsGrid/index.tsx index 359b0b809..1cdccc0b3 100644 --- a/components/Loyalty/Blocks/CardsGrid/index.tsx +++ b/components/Loyalty/Blocks/CardsGrid/index.tsx @@ -1,5 +1,5 @@ import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" import Card from "@/components/TempDesignSystem/Card" import Grids from "@/components/TempDesignSystem/Grids" import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard" @@ -13,7 +13,7 @@ export default function CardsGrid({ }: CardsGridProps) { return ( -
{dynamicContent.subtitle} ) : displayHeader ? ( -
) : null} + {displayHeader && ( + + )} ) } diff --git a/components/MyPages/Blocks/Benefits/CurrentLevel/index.tsx b/components/MyPages/Blocks/Benefits/CurrentLevel/index.tsx index 5b254bfb1..390f61834 100644 --- a/components/MyPages/Blocks/Benefits/CurrentLevel/index.tsx +++ b/components/MyPages/Blocks/Benefits/CurrentLevel/index.tsx @@ -2,7 +2,8 @@ import { MembershipLevelEnum } from "@/constants/membershipLevels" import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import Grids from "@/components/TempDesignSystem/Grids" import Link from "@/components/TempDesignSystem/Link" import BiroScript from "@/components/TempDesignSystem/Text/BiroScript" @@ -47,7 +48,7 @@ export default async function CurrentBenefitsBlock({ return ( -
+ {currentLevel.benefits.map((benefit, idx) => ( @@ -64,6 +65,7 @@ export default async function CurrentBenefitsBlock({ ))} + ) } diff --git a/components/MyPages/Blocks/Benefits/NextLevel/index.tsx b/components/MyPages/Blocks/Benefits/NextLevel/index.tsx index d8ac76a95..b92b1818e 100644 --- a/components/MyPages/Blocks/Benefits/NextLevel/index.tsx +++ b/components/MyPages/Blocks/Benefits/NextLevel/index.tsx @@ -4,7 +4,8 @@ import { MembershipLevelEnum } from "@/constants/membershipLevels" import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import Chip from "@/components/TempDesignSystem/Chip" import Grids from "@/components/TempDesignSystem/Grids" import BiroScript from "@/components/TempDesignSystem/Text/BiroScript" @@ -39,7 +40,7 @@ export default async function NextLevelBenefitsBlock({ // TODO: how to handle different count of unlockable benefits? return ( -
+ {nextLevel.benefits.map((benefit) => (
@@ -63,6 +64,7 @@ export default async function NextLevelBenefitsBlock({
))}
+ ) } diff --git a/components/MyPages/Blocks/Overview/index.tsx b/components/MyPages/Blocks/Overview/index.tsx index 31caee281..d9008147d 100644 --- a/components/MyPages/Blocks/Overview/index.tsx +++ b/components/MyPages/Blocks/Overview/index.tsx @@ -1,7 +1,8 @@ import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import Divider from "@/components/TempDesignSystem/Divider" import Friend from "./Friend" @@ -24,12 +25,13 @@ export default async function Overview({ } return ( -
+
+ ) } diff --git a/components/MyPages/Blocks/Points/CurrentPointsBalance/index.tsx b/components/MyPages/Blocks/Points/CurrentPointsBalance/index.tsx index 27ec6317b..d1ff4a7b1 100644 --- a/components/MyPages/Blocks/Points/CurrentPointsBalance/index.tsx +++ b/components/MyPages/Blocks/Points/CurrentPointsBalance/index.tsx @@ -1,7 +1,8 @@ import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import { getIntl } from "@/i18n" import { getMembership } from "@/utils/user" @@ -22,7 +23,7 @@ async function CurrentPointsBalance({ const membership = getMembership(user.memberships) return ( -
+

{`${formatMessage({ id: "Total Points" })}*`}

@@ -32,6 +33,7 @@ async function CurrentPointsBalance({ {`*${formatMessage({ id: "Points may take up to 10 days to be displayed." })}`}

+ ) } diff --git a/components/MyPages/Blocks/Points/EarnAndBurn/index.tsx b/components/MyPages/Blocks/Points/EarnAndBurn/index.tsx index f0b4d2ff0..a7b1d9457 100644 --- a/components/MyPages/Blocks/Points/EarnAndBurn/index.tsx +++ b/components/MyPages/Blocks/Points/EarnAndBurn/index.tsx @@ -1,7 +1,8 @@ import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import ClientEarnAndBurn from "./Client" @@ -20,8 +21,9 @@ export default async function EarnAndBurn({ } return ( -
+ + ) } diff --git a/components/MyPages/Blocks/Shortcuts/index.tsx b/components/MyPages/Blocks/Shortcuts/index.tsx index aeb4fe264..3f2012708 100644 --- a/components/MyPages/Blocks/Shortcuts/index.tsx +++ b/components/MyPages/Blocks/Shortcuts/index.tsx @@ -1,6 +1,6 @@ import { ArrowRightIcon } from "@/components/Icons" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" import Link from "@/components/TempDesignSystem/Link" import Body from "@/components/TempDesignSystem/Text/Body" @@ -16,12 +16,7 @@ export default function Shortcuts({ }: ShortcutsProps) { return ( -
+
{shortcuts.map((shortcut) => ( + ) } diff --git a/components/MyPages/Blocks/Stays/Soonest/index.tsx b/components/MyPages/Blocks/Stays/Soonest/index.tsx index bceb74967..a3d724d6f 100644 --- a/components/MyPages/Blocks/Stays/Soonest/index.tsx +++ b/components/MyPages/Blocks/Stays/Soonest/index.tsx @@ -1,7 +1,8 @@ import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" -import Header from "@/components/Section/Header" +import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import Grids from "@/components/TempDesignSystem/Grids" import StayCard from "../StayCard" @@ -22,7 +23,7 @@ export default async function SoonestStays({ return ( -
+ {response.data.length ? ( {response.data.map((stay) => ( @@ -36,6 +37,7 @@ export default async function SoonestStays({ ) : ( )} + ) } diff --git a/components/MyPages/Blocks/Stays/Upcoming/index.tsx b/components/MyPages/Blocks/Stays/Upcoming/index.tsx index 736251cfa..6e6c7feff 100644 --- a/components/MyPages/Blocks/Stays/Upcoming/index.tsx +++ b/components/MyPages/Blocks/Stays/Upcoming/index.tsx @@ -2,6 +2,7 @@ import { serverClient } from "@/lib/trpc/server" import SectionContainer from "@/components/Section/Container" import SectionHeader from "@/components/Section/Header" +import SectionLink from "@/components/Section/Link" import ClientUpcomingStays from "./Client" import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays" @@ -29,6 +30,7 @@ export default async function UpcomingStays({ ) : ( )} + ) } diff --git a/components/Section/Header/header.module.css b/components/Section/Header/header.module.css index e5d762621..0a0b6513e 100644 --- a/components/Section/Header/header.module.css +++ b/components/Section/Header/header.module.css @@ -10,23 +10,6 @@ grid-column: 1 / -1; } -.linkWrapper { - display: flex; - align-items: baseline; - gap: var(--Spacing-x-half); - grid-column: 1 / -1; - justify-self: start; -} - -.link { - display: flex; - align-items: center; -} - -.icon { - align-self: center; -} - @media screen and (min-width: 768px) { .header { grid-template-columns: 1fr auto; @@ -39,13 +22,4 @@ .subtitle { grid-column: 1 / 2; } - - .linkWrapper { - grid-column: 2 / 3; - justify-self: end; - } - - .link { - align-items: baseline; - } } diff --git a/components/Section/Header/index.tsx b/components/Section/Header/index.tsx index 925deb330..228d3b6ac 100644 --- a/components/Section/Header/index.tsx +++ b/components/Section/Header/index.tsx @@ -1,8 +1,8 @@ -import ArrowRight from "@/components/Icons/ArrowRight" -import Link from "@/components/TempDesignSystem/Link" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import Title from "@/components/TempDesignSystem/Text/Title" +import SectionLink from "../Link" + import styles from "./header.module.css" import type { HeaderProps } from "@/types/components/myPages/header" @@ -23,19 +23,7 @@ export default function SectionHeader({ {title} {subtitle && {subtitle}} - {link ? ( - - - - {link.text} - - - ) : null} +
) } diff --git a/components/Section/Link/index.tsx b/components/Section/Link/index.tsx new file mode 100644 index 000000000..924e81620 --- /dev/null +++ b/components/Section/Link/index.tsx @@ -0,0 +1,27 @@ +import ArrowRight from "@/components/Icons/ArrowRight" +import Link from "@/components/TempDesignSystem/Link" + +import { SectionLinkProps } from "./link" +import { linkVariants } from "./variants" + +import styles from "./link.module.css" + +export default function SectionLink({ link, variant }: SectionLinkProps) { + if (!link) { + return null + } + const classNames = linkVariants({ + variant, + }) + return ( + + + {link.text} + + ) +} diff --git a/components/Section/Link/link.module.css b/components/Section/Link/link.module.css new file mode 100644 index 000000000..fecf1be6b --- /dev/null +++ b/components/Section/Link/link.module.css @@ -0,0 +1,30 @@ +.linkWrapper { + align-items: baseline; + gap: var(--Spacing-x-half); +} + +.mobile { + display: flex; + grid-column: 1 / -1; + justify-self: center; +} + +.desktop { + display: none; +} + +.icon { + align-self: center; +} + +@media screen and (min-width: 768px) { + .mobile { + display: none; + } + + .desktop { + display: flex; + grid-column: 2 / 3; + justify-self: end; + } +} diff --git a/components/Section/Link/link.ts b/components/Section/Link/link.ts new file mode 100644 index 000000000..a5a39a9a1 --- /dev/null +++ b/components/Section/Link/link.ts @@ -0,0 +1,9 @@ +import { linkVariants } from "./variants" + +import type { VariantProps } from "class-variance-authority" + +export interface SectionLinkProps + extends React.PropsWithChildren>, + VariantProps { + link?: { href: string; text: string } +} diff --git a/components/Section/Link/variants.ts b/components/Section/Link/variants.ts new file mode 100644 index 000000000..ec5f06081 --- /dev/null +++ b/components/Section/Link/variants.ts @@ -0,0 +1,15 @@ +import { cva } from "class-variance-authority" + +import styles from "./link.module.css" + +export const linkVariants = cva(styles.linkWrapper, { + variants: { + variant: { + mobile: styles.mobile, + desktop: styles.desktop, + }, + }, + defaultVariants: { + variant: "mobile", + }, +})