From cd29e54098be73b44d7b4b70ed91543bf13295d9 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Wed, 13 Aug 2025 14:37:29 +0000 Subject: [PATCH] Merged in feat/sw-3244-move-imagecontainer-to-design-system (pull request #2637) feat(SW-3244): Move ImageContainer component to design-system * Move ImageContainer component to design-system * Fix imports Approved-by: Bianca Widstam --- .../DeprecatedJsonToHtml/renderOptions.tsx | 2 +- .../components/JsonToHtml/renderOptions.tsx | 2 +- .../types/components/imageContainer.ts | 6 ----- .../ImageContainer/imageContainer.module.css | 0 .../lib}/components/ImageContainer/index.tsx | 25 ++++++++++++++++--- packages/design-system/package.json | 1 + 6 files changed, 24 insertions(+), 12 deletions(-) delete mode 100644 apps/scandic-web/types/components/imageContainer.ts rename {apps/scandic-web => packages/design-system/lib}/components/ImageContainer/imageContainer.module.css (100%) rename {apps/scandic-web => packages/design-system/lib}/components/ImageContainer/index.tsx (69%) diff --git a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx index cf093d75e..6fda55627 100644 --- a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx @@ -4,6 +4,7 @@ import Caption from "@scandic-hotels/design-system/Caption" import { Divider } from "@scandic-hotels/design-system/Divider" import Footnote from "@scandic-hotels/design-system/Footnote" import Image from "@scandic-hotels/design-system/Image" +import ImageContainer from "@scandic-hotels/design-system/ImageContainer" import Link from "@scandic-hotels/design-system/Link" import Subtitle from "@scandic-hotels/design-system/Subtitle" import Title from "@scandic-hotels/design-system/Title" @@ -14,7 +15,6 @@ import { } from "@scandic-hotels/trpc/types/RTEenums" import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault" -import ImageContainer from "../ImageContainer" import Table from "../TempDesignSystem/Table" import BiroScript from "../TempDesignSystem/Text/BiroScript" import { hasAvailableParagraphFormat, hasAvailableULFormat } from "./utils" diff --git a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx index b64844bfd..072506555 100644 --- a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx @@ -3,12 +3,12 @@ import { cx } from "class-variance-authority" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Image from "@scandic-hotels/design-system/Image" +import ImageContainer from "@scandic-hotels/design-system/ImageContainer" import Link from "@scandic-hotels/design-system/Link" import { Typography } from "@scandic-hotels/design-system/Typography" import { ContentEnum } from "@scandic-hotels/trpc/types/content" import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault" -import ImageContainer from "../ImageContainer" import Table from "../TempDesignSystem/Table" import { hasAvailableParagraphFormat, diff --git a/apps/scandic-web/types/components/imageContainer.ts b/apps/scandic-web/types/components/imageContainer.ts deleted file mode 100644 index e5141e363..000000000 --- a/apps/scandic-web/types/components/imageContainer.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" - -export type ImageContainerProps = { - leftImage: ImageVaultAsset - rightImage: ImageVaultAsset -} diff --git a/apps/scandic-web/components/ImageContainer/imageContainer.module.css b/packages/design-system/lib/components/ImageContainer/imageContainer.module.css similarity index 100% rename from apps/scandic-web/components/ImageContainer/imageContainer.module.css rename to packages/design-system/lib/components/ImageContainer/imageContainer.module.css diff --git a/apps/scandic-web/components/ImageContainer/index.tsx b/packages/design-system/lib/components/ImageContainer/index.tsx similarity index 69% rename from apps/scandic-web/components/ImageContainer/index.tsx rename to packages/design-system/lib/components/ImageContainer/index.tsx index 5d66ebf43..9bf230c78 100644 --- a/apps/scandic-web/components/ImageContainer/index.tsx +++ b/packages/design-system/lib/components/ImageContainer/index.tsx @@ -1,9 +1,26 @@ -import Caption from "@scandic-hotels/design-system/Caption" -import Image from "@scandic-hotels/design-system/Image" +import Caption from '../Caption' +import Image from '../Image' -import styles from "./imageContainer.module.css" +import styles from './imageContainer.module.css' -import type { ImageContainerProps } from "@/types/components/imageContainer" +type Image = { + id: number + title: string + url: string + focalPoint: { + x: number + y: number + } + meta: { + alt?: string | null + caption?: string | null + } +} + +type ImageContainerProps = { + leftImage: Image + rightImage: Image +} export default function ImageContainer({ leftImage, diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 10bf82a72..4cb402a4c 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -26,6 +26,7 @@ "./Form/RadioCard": "./lib/components/Form/RadioCard/index.tsx", "./IconChip": "./lib/components/IconChip/index.tsx", "./Image": "./lib/components/Image.tsx", + "./ImageContainer": "./lib/components/ImageContainer/index.tsx", "./ImageFallback": "./lib/components/ImageFallback/index.tsx", "./ImageGallery": "./lib/components/ImageGallery/index.tsx", "./Input": "./lib/components/Input/index.tsx",