diff --git a/packages/drupal/gutenberg_blocks/css/edit.css b/packages/drupal/gutenberg_blocks/css/edit.css index f4dd2c543..f4a49c277 100644 --- a/packages/drupal/gutenberg_blocks/css/edit.css +++ b/packages/drupal/gutenberg_blocks/css/edit.css @@ -10,4 +10,28 @@ .gutenberg__editor blockquote::before, .gutenberg__editor blockquote::after { content: ''; +} + +.gutenberg__editor .container-wrapper { + display: block; + position: relative; + margin: 40px 0; + border-left: 34px solid #666666; + padding-left: 10px; + min-height: 250px; +} + +.gutenberg__editor .container-wrapper .container-label { + font: bold 12px Sans-Serif; + letter-spacing: 2px; + text-transform: uppercase; + color: #fff; + padding: 5px 10px; + margin: 0 0 10px 0; + line-height: 24px; + position: absolute; + top: 0; + left: 0; + transform-origin: 0 0; + transform: rotate(90deg); } \ No newline at end of file diff --git a/packages/drupal/gutenberg_blocks/src/blocks/hero.tsx b/packages/drupal/gutenberg_blocks/src/blocks/hero.tsx index 12fd053a3..e87401af8 100644 --- a/packages/drupal/gutenberg_blocks/src/blocks/hero.tsx +++ b/packages/drupal/gutenberg_blocks/src/blocks/hero.tsx @@ -182,7 +182,8 @@ registerBlockType('custom/hero', {
{ return ( - <> +
+
{__('Image Teasers')}
- +
); }, save: () => , diff --git a/packages/ui/src/components/Organisms/Footer.tsx b/packages/ui/src/components/Organisms/Footer.tsx index 059b57695..b318df60b 100644 --- a/packages/ui/src/components/Organisms/Footer.tsx +++ b/packages/ui/src/components/Organisms/Footer.tsx @@ -73,7 +73,7 @@ export function Footer() {
- + {item.title} @@ -174,7 +171,7 @@ export function Footer() { {child.title} diff --git a/packages/ui/src/components/Organisms/PageContent/BlockForm.stories.tsx b/packages/ui/src/components/Organisms/PageContent/BlockForm.stories.tsx index 9d255cea9..4b9471c37 100644 --- a/packages/ui/src/components/Organisms/PageContent/BlockForm.stories.tsx +++ b/packages/ui/src/components/Organisms/PageContent/BlockForm.stories.tsx @@ -19,5 +19,6 @@ export const Error = { args: { url: 'webforms/error/index.html' as Url, cssStylesToInject: cmsCss, + className: 'mt-16', }, } satisfies StoryObj; diff --git a/packages/ui/src/components/Organisms/PageContent/BlockForm.tsx b/packages/ui/src/components/Organisms/PageContent/BlockForm.tsx index 6746edfc5..8ee6770a1 100644 --- a/packages/ui/src/components/Organisms/PageContent/BlockForm.tsx +++ b/packages/ui/src/components/Organisms/PageContent/BlockForm.tsx @@ -1,11 +1,13 @@ import { SilverbackIframe } from '@amazeelabs/silverback-iframe'; import { BlockFormFragment, Url, useLocation } from '@custom/schema'; +import clsx from 'clsx'; import React from 'react'; import { buildMessages, storeMessages } from '../../Molecules/Messages'; export function BlockForm( props: BlockFormFragment & { + className?: string; // For Storybook. cssStylesToInject?: string; }, @@ -17,7 +19,7 @@ export function BlockForm( } return ( -
+
{unordered ? ( - + ) : null} {children} diff --git a/packages/ui/src/components/Organisms/PageContent/BlockMedia.tsx b/packages/ui/src/components/Organisms/PageContent/BlockMedia.tsx index a2d9ec34d..4907c2486 100644 --- a/packages/ui/src/components/Organisms/PageContent/BlockMedia.tsx +++ b/packages/ui/src/components/Organisms/PageContent/BlockMedia.tsx @@ -13,7 +13,7 @@ export function BlockMedia(props: BlockMediaFragment) {
{props.caption ? ( -
+
) : null} @@ -27,7 +27,7 @@ function Media(props: Required['media']) { case 'MediaImage': return ( {props.alt} diff --git a/packages/ui/src/components/Organisms/PageHero.tsx b/packages/ui/src/components/Organisms/PageHero.tsx index a90c9e778..c043a10c0 100644 --- a/packages/ui/src/components/Organisms/PageHero.tsx +++ b/packages/ui/src/components/Organisms/PageHero.tsx @@ -1,9 +1,21 @@ import { Image, Link, PageFragment } from '@custom/schema'; import React from 'react'; +import { BlockForm } from './PageContent/BlockForm'; + export function PageHero(props: NonNullable) { + return props.formUrl ? ( + + ) : props.image ? ( + + ) : ( + + ); +} + +function DefaultHero(props: NonNullable) { return ( -
+
{props.image ? ( {props.image.alt}) { data-test-id={'hero-image'} /> ) : null} -
+ ); +} + +function FormHero(props: NonNullable) { + return ( +
+
+ {props.image ? ( + {props.image.alt} + ) : null} + +
+

+ {props.headline} +

+ {props.lead ? ( +

{props.lead}

+ ) : null} + {props.ctaText && props.ctaUrl ? ( + + + + + {props.ctaText} + + ) : null} +
+
+ {props.formUrl ? ( +
+
+ +
+
+ ) : null} +
+ ); +} + +function NoImageHero(props: NonNullable) { + return ( +
+
+
+

+ {props.headline} +

+ {props.lead ? ( +

{props.lead}

+ ) : null} + {props.ctaText && props.ctaUrl ? ( + + + + {props.ctaText} ) : null}
-
+ ); } diff --git a/packages/ui/src/components/Routes/Page.stories.tsx b/packages/ui/src/components/Routes/Page.stories.tsx index dc50f159d..f3d048c25 100644 --- a/packages/ui/src/components/Routes/Page.stories.tsx +++ b/packages/ui/src/components/Routes/Page.stories.tsx @@ -42,6 +42,9 @@ export const Default = { path: '/test' as Url, hero: { headline: 'Page Hero Headline', + lead: 'A longer lead text that even might break into multiple lines.', + ctaUrl: '/test' as Url, + ctaText: 'Call to action', }, content: [ { @@ -80,3 +83,24 @@ export const FullHero = { }, }, } satisfies StoryObj; + +export const FormHero = { + ...Default, + args: { + ...Default.args, + page: { + ...Default.args.page, + hero: { + headline: 'Page Hero Headline', + lead: 'A longer lead text that even might break into multiple lines.', + image: { + source: image(Landscape, { width: 2000 }), + alt: 'Stock photo landscape hero.', + }, + ctaUrl: '/test' as Url, + ctaText: 'Call to action', + formUrl: 'webforms/error/index.html' as Url, + }, + }, + }, +} satisfies StoryObj; diff --git a/tests/e2e/specs/drupal/blocks.spec.ts b/tests/e2e/specs/drupal/blocks.spec.ts index 22c58036a..ec7dc6a1b 100644 --- a/tests/e2e/specs/drupal/blocks.spec.ts +++ b/tests/e2e/specs/drupal/blocks.spec.ts @@ -56,8 +56,7 @@ test('All blocks are rendered', async ({ page }) => { ); // Form - await expect(page.locator('.silverback-iframe iframe')).toHaveAttribute( - 'src', - 'http://127.0.0.1:8000/en/form/contact?iframe=true', - ); + await expect( + page.locator('.silverback-iframe iframe').last(), + ).toHaveAttribute('src', 'http://127.0.0.1:8000/en/form/contact?iframe=true'); }); diff --git a/tests/e2e/specs/drupal/webforms.spec.ts b/tests/e2e/specs/drupal/webforms.spec.ts index d4fb48a29..d099cd505 100644 --- a/tests/e2e/specs/drupal/webforms.spec.ts +++ b/tests/e2e/specs/drupal/webforms.spec.ts @@ -8,6 +8,7 @@ test('Webforms work', async ({ page }) => { // Webform can be submitted. await page .frameLocator('.silverback-iframe iframe') + .last() .getByRole('button', { name: 'Send message' }) .click(); @@ -29,6 +30,7 @@ test('Webforms work', async ({ page }) => { await page.goto(websiteUrl('/de/blocks-complete')); await page .frameLocator('.silverback-iframe iframe') + .last() .getByRole('button', { name: 'Send message' }) .click(); // TODO: Find out why it does not work.