diff --git a/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.module.scss b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.module.scss new file mode 100644 index 0000000000..7c3115cdac --- /dev/null +++ b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.module.scss @@ -0,0 +1,35 @@ +.layout { + width: 100%; + flex-grow: 1; + overflow: hidden; + + .media { + width: 100%; + height: var(--modal-top-media-height, 240px); + flex-shrink: 0; + + @media (min-width: 1280px) { + --modal-top-media-height: 260px; + } + + @media (min-width: 1440px) { + --modal-top-media-height: 260px; + } + + @media (min-width: 1720px) { + --modal-top-media-height: 320px; + } + } + + .header { + width: 100%; + margin-block: var(--spacing-large) var(--spacing-small); + text-align: center; + } + + .content { + width: 100%; + flex: 1; + align-self: flex-start; + } +} diff --git a/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.tsx b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.tsx new file mode 100644 index 0000000000..e11a792264 --- /dev/null +++ b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.tsx @@ -0,0 +1,33 @@ +import React, { forwardRef } from "react"; +import cx from "classnames"; +import { getTestId } from "../../../../tests/test-ids-utils"; +import { ComponentDefaultTestId } from "../../../../tests/constants"; +import styles from "./ModalMediaLayout.module.scss"; +import { ModalMediaLayoutProps } from "./ModalMediaLayout.types"; +import Flex from "../../../Flex/Flex"; + +const ModalMediaLayout = forwardRef( + ( + { children, className, id, "data-testid": dataTestId }: ModalMediaLayoutProps, + ref: React.ForwardedRef + ) => { + const [media, header, content] = React.Children.toArray(children); + + return ( + +
{media}
+
{header}
+
{content}
+
+ ); + } +); + +export default ModalMediaLayout; diff --git a/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.types.ts b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.types.ts new file mode 100644 index 0000000000..3d9481f36f --- /dev/null +++ b/packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.types.ts @@ -0,0 +1,6 @@ +import React from "react"; +import { VibeComponentProps } from "../../../../types"; + +export interface ModalMediaLayoutProps extends VibeComponentProps { + children: React.ReactNode; +} diff --git a/packages/core/src/tests/constants.ts b/packages/core/src/tests/constants.ts index 8349b5b8e9..6666ce25d5 100644 --- a/packages/core/src/tests/constants.ts +++ b/packages/core/src/tests/constants.ts @@ -110,6 +110,7 @@ export enum ComponentDefaultTestId { MODAL_NEXT_MEDIA = "modal-media", MODAL_NEXT_BASIC_LAYOUT = "modal-basic-layout", MODAL_NEXT_SIDE_BY_SIDE_LAYOUT = "modal-side-by-side-layout", + MODAL_NEXT_MEDIA_LAYOUT = "modal-media-layout", FORMATTED_NUMBER = "formatted-number", HIDDEN_TEXT = "hidden-text", DIALOG_CONTENT_CONTAINER = "dialog-content-container",