diff --git a/apps/scandic-web/components/Blocks/index.tsx b/apps/scandic-web/components/Blocks/index.tsx index d32ef44dc..60635cc3a 100644 --- a/apps/scandic-web/components/Blocks/index.tsx +++ b/apps/scandic-web/components/Blocks/index.tsx @@ -38,12 +38,11 @@ export default function Blocks({ blocks }: BlocksProps) { ) case BlocksEnums.block.Content: return ( -
- -
+ ) case BlocksEnums.block.DynamicContent: return ( @@ -97,12 +96,11 @@ export default function Blocks({ blocks }: BlocksProps) { return case BlocksEnums.block.TextContent: return ( -
- -
+ ) case BlocksEnums.block.UspGrid: return diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx index 719762b7e..f476ce7ca 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx @@ -29,12 +29,11 @@ export default function Blocks({ blocks }: BlocksProps) { ) case BlocksEnums.block.Content: return ( -
- -
+ ) default: return null diff --git a/apps/scandic-web/components/JsonToHtml/jsontohtml.module.css b/apps/scandic-web/components/JsonToHtml/jsontohtml.module.css index ba23c7b8c..a023d2e7b 100644 --- a/apps/scandic-web/components/JsonToHtml/jsontohtml.module.css +++ b/apps/scandic-web/components/JsonToHtml/jsontohtml.module.css @@ -1,9 +1,52 @@ -.imageContainer { +.container { + max-width: var(--max-width-content); + margin: 0 auto; + + & > :first-child { + margin-top: 0; + } + & > :last-child { + margin-bottom: 0; + } +} + +.heading { + color: var(--Text-Heading); + margin-top: var(--Space-x3); +} + +.h1, +.h2 { + margin-bottom: var(--Space-x2); +} + +.h3, +.h4, +.h5, +.p, +.blockquote, +.code, +.divider, +.div { + margin-bottom: var(--Space-x15); +} + +.imageWithCaption { + display: grid; + gap: var(--Space-x1); + margin: var(--Space-x3) 0; + + .imageWrapper { + margin: 0; + } +} + +.imageWrapper { position: relative; width: 100%; height: 365px; border-radius: var(--Corner-radius-md); - margin: var(--Spacing-x1) var(--Spacing-x0); + margin: var(--Space-x3) 0; overflow: hidden; } @@ -14,17 +57,19 @@ .ul, .ol { - padding: var(--Spacing-x2) var(--Spacing-x0); display: grid; - gap: var(--Spacing-x1); + gap: var(--Space-x1); + padding: 0; + margin-top: var(--Space-x2); + margin-bottom: var(--Space-x2); } .ol > li::marker { - color: var(--Primary-Light-On-Surface-Accent); + color: var(--Icon-Accent); } .li { - margin-left: var(--Spacing-x3); + margin-left: var(--Space-x3); } .heart > .li::before, @@ -33,8 +78,8 @@ position: relative; height: 8px; top: 3px; - margin-right: var(--Spacing-x1); - margin-left: calc(var(--Spacing-x3) * -1); + margin-right: var(--Space-x1); + margin-left: calc(var(--Space-x3) * -1); } .heart > .li, @@ -50,23 +95,32 @@ position: relative; height: 8px; top: 3px; - margin-right: var(--Spacing-x1); - margin-left: calc(var(--Spacing-x3) * -1); -} - -.container { - display: grid; - gap: var(--Spacing-x3); - max-width: 1197px; + margin-right: var(--Space-x1); + margin-left: calc(var(--Space-x3) * -1); } .li > p { display: inline; + margin: 0; } .tableContainer { max-width: 100%; overflow-x: auto; + margin: var(--Space-x3) 0; +} + +.table .p { + display: inline; + margin: 0; +} + +.theadContent { + color: var(--Text-Heading); +} + +.iframe { + margin: var(--Space-x3) 0; } @media screen and (min-width: 768px) { diff --git a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx index e1ec011bd..8f1080509 100644 --- a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx @@ -1,3 +1,5 @@ +import { cx } from "class-variance-authority" + import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" @@ -8,12 +10,6 @@ import { insertResponseToImageVaultAsset } from "@/utils/imageVault" import ImageContainer from "../ImageContainer" import Divider from "../TempDesignSystem/Divider" import Table from "../TempDesignSystem/Table" -import BiroScript from "../TempDesignSystem/Text/BiroScript" -import Body from "../TempDesignSystem/Text/Body" -import Caption from "../TempDesignSystem/Text/Caption" -import Footnote from "../TempDesignSystem/Text/Footnote" -import Subtitle from "../TempDesignSystem/Text/Subtitle" -import Title from "../TempDesignSystem/Text/Title" import { hasAvailableParagraphFormat, hasAvailableULFormat, @@ -87,12 +83,13 @@ export const renderOptions: RenderOptions = { fullRenderOptions: RenderOptions ) => { if (node.attrs.url) { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( @@ -115,11 +112,13 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +
+ {next(node.children, embeds, fullRenderOptions)} +
+
) }, @@ -129,9 +128,9 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - + {next(node.children, embeds, fullRenderOptions)} ) @@ -143,7 +142,7 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) if (node.attrs.src) { props.src = node.attrs.src } @@ -154,7 +153,11 @@ export const renderOptions: RenderOptions = { return null } return ( - ) @@ -166,11 +169,13 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +

+ {next(node.children, embeds, fullRenderOptions)} +

+
) }, @@ -180,11 +185,13 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +

+ {next(node.children, embeds, fullRenderOptions)} +

+
) }, @@ -194,11 +201,13 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +

+ {next(node.children, embeds, fullRenderOptions)} +

+
) }, @@ -208,11 +217,13 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +

+ {next(node.children, embeds, fullRenderOptions)} +

+
) }, @@ -222,16 +233,18 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( - - {next(node.children, embeds, fullRenderOptions)} - + +
+ {next(node.children, embeds, fullRenderOptions)} +
+
) }, [RTETypeEnum.hr]: () => { - return + return }, [RTETypeEnum.li]: ( @@ -240,16 +253,16 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) const compatibleClassName = makeCssModuleCompatibleClassName( - props.className, + className, "ul" ) return (
  • {next(node.children, embeds, fullRenderOptions)}
  • @@ -262,7 +275,7 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) // Set the number of rows dynamically to create even rows for each column. We want the li:s // to flow with the column, so therefore this is needed. @@ -273,18 +286,19 @@ export const renderOptions: RenderOptions = { } return ( -
      - {next(node.children, embeds, fullRenderOptions)} -
    + +
      + {next(node.children, embeds, fullRenderOptions)} +
    +
    ) }, @@ -294,7 +308,7 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) const hasFormat = node.children.some((item) => hasAvailableParagraphFormat((item as RTETextNode)?.classname) @@ -307,9 +321,11 @@ export const renderOptions: RenderOptions = { } return ( - - {next(node.children, embeds, fullRenderOptions)} - + +

    + {next(node.children, embeds, fullRenderOptions)} +

    +
    ) }, @@ -319,20 +335,22 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - let props = extractPossibleAttributes(node.attrs) - const className = props.className + const { className, ...props } = extractPossibleAttributes(node.attrs) + let propsClassName = className if (className) { if (hasAvailableULFormat(className)) { // @ts-ignore: We want to set css modules classNames even if it does not correspond // to an existing class in the module style sheet. Due to our css modules plugin for // typescript, we cannot do this without the ts-ignore - props.className = styles[className] + propsClassName = styles[className] } } return ( - {next(node.children, embeds, fullRenderOptions)} + + {next(node.children, embeds, fullRenderOptions)} + ) }, [RTETypeEnum.div]: ( @@ -341,20 +359,22 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - let props = extractPossibleAttributes(node.attrs) - const className = props.className + const { className, ...props } = extractPossibleAttributes(node.attrs) + let propsClassName = props.className if (className) { if (hasAvailableULFormat(className)) { // @ts-ignore: We want to set css modules classNames even if it does not correspond // to an existing class in the module style sheet. Due to our css modules plugin for // typescript, we cannot do this without the ts-ignore - props.className = styles[className] + propsClassName = styles[className] } } return ( -
    {next(node.children, embeds, fullRenderOptions)}
    +
    + {next(node.children, embeds, fullRenderOptions)} +
    ) }, @@ -374,14 +394,15 @@ export const renderOptions: RenderOptions = { if (image?.node.__typename === ContentEnum.blocks.SysAsset) { if (image.node.url) { const alt = image?.node?.title ?? node.attrs.alt - const props = extractPossibleAttributes(node.attrs) - props.className = styles.image + const { className, ...props } = extractPossibleAttributes( + node.attrs + ) return ( -
    +
    {alt} {next( // Sometimes editors happen to nest a reference inside a link and vice versa. @@ -420,6 +444,7 @@ export const renderOptions: RenderOptions = { if (entry.node.image_left && entry.node.image_right) { return ( @@ -440,13 +465,14 @@ export const renderOptions: RenderOptions = { entry?.node.__typename === ContentEnum.blocks.StartPage ) { // If entry is not an ImageContainer, it is a page and we return it as a link - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( {next( @@ -477,13 +503,14 @@ export const renderOptions: RenderOptions = { image = insertResponseToImageVaultAsset(attrs) } const alt = image.meta.alt ?? image.title - const props = extractPossibleAttributes(attrs) + const caption = image.meta.caption + const { className, ...props } = extractPossibleAttributes(attrs) return ( -
    -
    +
    +
    {alt}
    - {image.meta.caption} -
    + {caption ? ( + +

    {image.meta.caption}

    +
    + ) : null} +
    ) } } @@ -506,10 +537,10 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) return ( -
    - +
    +
    {next(node.children, embeds, fullRenderOptions)}
    @@ -531,9 +562,11 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => ( - - {next(node.children, embeds, fullRenderOptions)} - + + + {next(node.children, embeds, fullRenderOptions)} + + ), } const props = extractPossibleAttributes(node.attrs) @@ -629,9 +662,9 @@ export const renderOptions: RenderOptions = { next: RTENext, fullRenderOptions: RenderOptions ) => { - const props = extractPossibleAttributes(node.attrs) + const { className, ...props } = extractPossibleAttributes(node.attrs) const compatibleClassName = makeCssModuleCompatibleClassName( - props.className, + className, "ul" ) @@ -644,10 +677,10 @@ export const renderOptions: RenderOptions = { } return ( - +
      { - return {children} + return ( + + {children} + + ) }, [RTEMarkType.italic]: (children: React.ReactNode) => { @@ -672,7 +709,11 @@ export const renderOptions: RenderOptions = { }, [RTEMarkType.underline]: (children: React.ReactNode) => { - return {children} + return ( + + {children} + + ) }, [RTEMarkType.strikethrough]: (children: React.ReactNode) => { @@ -705,13 +746,9 @@ export const renderOptions: RenderOptions = { className?: string, id?: string ) => { - let props = { - className, - id, - } - if (!className) { - delete props.className - } + const props = { id } + let propsClassName = className + if (!id) { delete props.id } @@ -721,60 +758,74 @@ export const renderOptions: RenderOptions = { // @ts-ignore: We want to set css modules classNames even if it does not correspond // to an existing class in the module style sheet. Due to our css modules plugin for // typescript, we cannot do this without the ts-ignore - props.className = styles[className] + propsClassName = styles[className] } } if (className === AvailableParagraphFormatEnum.footnote) { return ( - - {children} - + +

      + {children} +

      +
      ) } if (className === AvailableParagraphFormatEnum.caption) { return ( - - {children} - + +

      + {children} +

      +
      ) } if (className === AvailableParagraphFormatEnum["script-1"]) { return ( - - {children} - + +

      + {children} +

      +
      ) } if (className === AvailableParagraphFormatEnum["script-2"]) { return ( - - {children} - + +

      + {children} +

      +
      ) } if (className === AvailableParagraphFormatEnum["subtitle-1"]) { return ( - - {children} - + +

      + {children} +

      +
      ) } if (className === AvailableParagraphFormatEnum["subtitle-2"]) { return ( - - {children} - + +

      + {children} +

      +
      ) } return ( - - {children} - + + + {children} + + ) }, diff --git a/apps/scandic-web/components/Sidebar/index.tsx b/apps/scandic-web/components/Sidebar/index.tsx index ac1ad3c32..a3c7d6438 100644 --- a/apps/scandic-web/components/Sidebar/index.tsx +++ b/apps/scandic-web/components/Sidebar/index.tsx @@ -20,12 +20,11 @@ export default function Sidebar({ blocks }: SidebarProps) { switch (block.typename) { case SidebarEnums.blocks.Content: return ( -
      - -
      + ) case SidebarEnums.blocks.DynamicContent: switch (block.dynamic_content.component) { diff --git a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx index 18e03eb39..b194430e5 100644 --- a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx @@ -80,14 +80,13 @@ export default async function Content({ content }: ContentProps) { ) case BlocksEnums.block.TextContent: return ( -
      - -
      + ) default: return null diff --git a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx index 6b5c54b53..8bcfbab4c 100644 --- a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx @@ -23,12 +23,11 @@ export default async function Blocks({ blocks }: BlocksProps) { ) case BlocksEnums.block.Content: return ( -
      - -
      + ) case BlocksEnums.block.DynamicContent: const dynamicContent = {