From 314ce782407dfa4edbddb7cc7753519e8a597e3f Mon Sep 17 00:00:00 2001 From: Mattia Simonato Date: Sat, 18 May 2024 16:05:19 +0200 Subject: [PATCH] feat(SLB-287): update naming to be compliant with backend --- ...ries.tsx => BlockImageTeasers.stories.tsx} | 8 +++---- ...ndImageCards.tsx => BlockImageTeasers.tsx} | 23 +++++++++---------- .../src/components/Organisms/PageDisplay.tsx | 4 ++-- .../ui/src/components/Routes/Page.stories.tsx | 6 ++--- packages/ui/src/tailwind.css | 9 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) rename packages/ui/src/components/Organisms/PageContent/{BlockBackgroundImageCards.stories.tsx => BlockImageTeasers.stories.tsx} (76%) rename packages/ui/src/components/Organisms/PageContent/{BlockBackgroundImageCards.tsx => BlockImageTeasers.tsx} (57%) diff --git a/packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.stories.tsx b/packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.stories.tsx similarity index 76% rename from packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.stories.tsx rename to packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.stories.tsx index 316056a66..6b90bf401 100644 --- a/packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.stories.tsx +++ b/packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.stories.tsx @@ -4,11 +4,11 @@ import Portrait from '@stories/portrait.jpg?as=metadata'; import { Meta, StoryObj } from '@storybook/react'; import { image } from '../../../helpers/image'; -import { BlockBackgroundImageCards } from './BlockBackgroundImageCards'; +import { BlockImageTeasers } from './BlockImageTeasers'; export default { - component: BlockBackgroundImageCards, -} satisfies Meta; + component: BlockImageTeasers, +} satisfies Meta; export const Default = { args: { @@ -33,4 +33,4 @@ export const Default = { }, ], }, -} satisfies StoryObj; +} satisfies StoryObj; diff --git a/packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.tsx b/packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.tsx similarity index 57% rename from packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.tsx rename to packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.tsx index f3cbc828b..0b3472b57 100644 --- a/packages/ui/src/components/Organisms/PageContent/BlockBackgroundImageCards.tsx +++ b/packages/ui/src/components/Organisms/PageContent/BlockImageTeasers.tsx @@ -1,21 +1,16 @@ -import { - BlockImageTeaser, - BlockImageTeasers, - Image, - Link, -} from '@custom/schema'; +import { BlockImageTeasersFragment, Image, Link } from '@custom/schema'; import React from 'react'; import { isTruthy } from '../../../utils/isTruthy'; -export function BlockBackgroundImageCards(props: BlockImageTeasers) { +export function BlockImageTeasers(props: BlockImageTeasersFragment) { return ( // eslint-disable-next-line tailwindcss/no-custom-classname
{props.teasers.filter(isTruthy).map((teaser, index) => ( - + ))}
@@ -23,9 +18,13 @@ export function BlockBackgroundImageCards(props: BlockImageTeasers) { ); } -export function BlockBackgroundImageCard(props: BlockImageTeaser) { +// This component uses the following Flowbite component: +// https://flowbite.com/blocks/marketing/hero/#background-image-cards +export function BlockImageTeaser( + props: BlockImageTeasersFragment['teasers'][0], +) { return ( -
+
{props.image ? ( {props.title ? ( -

+

{props.title}

) : null} @@ -45,7 +44,7 @@ export function BlockBackgroundImageCard(props: BlockImageTeaser) { {props.ctaText} diff --git a/packages/ui/src/components/Organisms/PageDisplay.tsx b/packages/ui/src/components/Organisms/PageDisplay.tsx index ac0653273..9476bfc9d 100644 --- a/packages/ui/src/components/Organisms/PageDisplay.tsx +++ b/packages/ui/src/components/Organisms/PageDisplay.tsx @@ -5,11 +5,11 @@ import { isTruthy } from '../../utils/isTruthy'; import { UnreachableCaseError } from '../../utils/unreachable-case-error'; import { BreadCrumbs } from '../Molecules/Breadcrumbs'; import { PageTransition } from '../Molecules/PageTransition'; -import { BlockBackgroundImageCards } from './PageContent/BlockBackgroundImageCards'; import { BlockAccordion } from './PageContent/BlockAccordion'; import { BlockCta } from './PageContent/BlockCta'; import { BlockForm } from './PageContent/BlockForm'; import { BlockHorizontalSeparator } from './PageContent/BlockHorizontalSeparator'; +import { BlockImageTeasers } from './PageContent/BlockImageTeasers'; import { BlockImageWithText } from './PageContent/BlockImageWithText'; import { BlockMarkup } from './PageContent/BlockMarkup'; import { BlockMedia } from './PageContent/BlockMedia'; @@ -31,7 +31,7 @@ export function PageDisplay(page: PageFragment) { case 'BlockForm': return ; case 'BlockImageTeasers': - return ; + return ; case 'BlockCta': return ; case 'BlockImageWithText': diff --git a/packages/ui/src/components/Routes/Page.stories.tsx b/packages/ui/src/components/Routes/Page.stories.tsx index e28a07194..cad363277 100644 --- a/packages/ui/src/components/Routes/Page.stories.tsx +++ b/packages/ui/src/components/Routes/Page.stories.tsx @@ -11,8 +11,8 @@ import React from 'react'; import { image } from '../../helpers/image'; import { AccordionItemText } from '../Organisms/PageContent/BlockAccordion.stories'; +import { Default as BlockImageTeasers } from '../Organisms/PageContent/BlockImageTeasers.stories'; import { ImageRight } from '../Organisms/PageContent/BlockImageWithText.stories'; -import { Default as BlockBackgroundImageCards } from '../Organisms/PageContent/BlockBackgroundImageCards.stories'; import { Mixed, Paragraph } from '../Organisms/PageContent/BlockMarkup.stories'; import { WithCaption } from '../Organisms/PageContent/BlockMedia.stories'; import { Default as FrameStory } from './Frame.stories'; @@ -46,7 +46,7 @@ export const Default = { content: [ { __typename: 'BlockImageTeasers', - ...BlockBackgroundImageCards.args, + ...BlockImageTeasers.args, }, { __typename: 'BlockMarkup', @@ -70,7 +70,7 @@ export const Default = { }, { __typename: 'BlockImageTeasers', - ...BlockBackgroundImageCards.args, + ...BlockImageTeasers.args, }, ] as Exclude['content'], }, diff --git a/packages/ui/src/tailwind.css b/packages/ui/src/tailwind.css index 6c6304940..18682f9a6 100644 --- a/packages/ui/src/tailwind.css +++ b/packages/ui/src/tailwind.css @@ -36,9 +36,10 @@ content: '' !important; } -/* Selects the .block-background-image-cards only when it is the first child of the
- element immediately following the .default-hero section. +/* + Selects the .block-background-image-cards only when it is the direct + sibling of .default-hero section. */ -.default-hero + div > :first-child.block-background-image-cards { +.default-hero + .block-background-image-cards { @apply mt-2 px-0; -} \ No newline at end of file +}