From 3eb7e5f65309d07635750a11d8fb0b4cadb88c52 Mon Sep 17 00:00:00 2001 From: Chuma McPhoy Date: Wed, 11 Sep 2024 15:40:41 +0200 Subject: [PATCH] feat(SW-219): add ability to always stack buttons --- components/ContentType/HotelPage/index.tsx | 11 +++---- .../ContentCard/contentCard.module.css | 30 +++++++++++++++---- .../TempDesignSystem/ContentCard/index.tsx | 17 +++++++++-- .../TempDesignSystem/ContentCard/variants.ts | 5 ++++ types/components/contentCard.ts | 1 + 5 files changed, 51 insertions(+), 13 deletions(-) diff --git a/components/ContentType/HotelPage/index.tsx b/components/ContentType/HotelPage/index.tsx index 3737859fb..9770cfe33 100644 --- a/components/ContentType/HotelPage/index.tsx +++ b/components/ContentType/HotelPage/index.tsx @@ -67,11 +67,12 @@ export default async function HotelPage() { - - {/* Add ContentCard here */} + {/* NOTE: These are added here for testing. Remove before PR */} + {/* Example of ContentCard with Button CTA's */} {/* Example of ContentCard with SidePeek */} {googleMapsApiKey ? ( diff --git a/components/TempDesignSystem/ContentCard/contentCard.module.css b/components/TempDesignSystem/ContentCard/contentCard.module.css index e1fe789e0..9a90d97c7 100644 --- a/components/TempDesignSystem/ContentCard/contentCard.module.css +++ b/components/TempDesignSystem/ContentCard/contentCard.module.css @@ -14,6 +14,11 @@ background-color: var(--Main-Grey-White); } +.default, +.featured { + border: 1px solid var(--Base-Border-Subtle); +} + .imageContainer { width: 100%; height: 12.58625rem; /* 201.38px / 16 = 12.58625rem */ @@ -29,9 +34,9 @@ .content { display: flex; flex-direction: column; - gap: var(--Spacing-x2); + gap: var(--Spacing-x-one-and-half); align-items: flex-start; - padding: var(--Spacing-x4); + padding: var(--Spacing-x2) var(--Spacing-x3); } .description { @@ -39,9 +44,24 @@ } .ctaContainer { - display: flex; - gap: var(--Spacing-x2); - margin-top: var(--Spacing-x2); + display: grid; + grid-template-columns: 1fr; + gap: var(--Spacing-x1); + width: 100%; +} + +.ctaButton { + width: 100%; +} + +@media (min-width: 1367px) { + .card:not(.alwaysStack) .ctaContainer { + grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); + } + + .card:not(.alwaysStack) .ctaContainer:has(:only-child) { + grid-template-columns: 1fr; + } } .sidePeekCTA { diff --git a/components/TempDesignSystem/ContentCard/index.tsx b/components/TempDesignSystem/ContentCard/index.tsx index d65542389..0185ad239 100644 --- a/components/TempDesignSystem/ContentCard/index.tsx +++ b/components/TempDesignSystem/ContentCard/index.tsx @@ -21,9 +21,10 @@ export default function ContentCard({ sidePeekCTA, backgroundImage, style = "default", + alwaysStack = false, className, }: ContentCardProps) { - const cardClasses = contentCardVariants({ style, className }) + const cardClasses = contentCardVariants({ style, alwaysStack, className }) return (
@@ -58,7 +59,12 @@ export default function ContentCard({ ) : (
{primaryCTA && ( -