-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ModalHeroLayout): hero layout component for new Modal
- Loading branch information
1 parent
9d43dca
commit 88edc35
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/core/src/components/ModalNew/layouts/ModalHeroLayout/ModalHeroLayout.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.layout { | ||
width: 100%; | ||
flex-grow: 1; | ||
overflow: hidden; | ||
|
||
.header { | ||
border: 1px dashed #c74646; | ||
|
||
width: 100%; | ||
margin-block: var(--spacing-large) var(--spacing-small); | ||
text-align: center; | ||
} | ||
|
||
.content { | ||
flex: 1; | ||
width: 100%; | ||
align-self: flex-start; | ||
} | ||
|
||
.media { | ||
height: 260px; | ||
flex-shrink: 0; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/core/src/components/ModalNew/layouts/ModalHeroLayout/ModalHeroLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "./ModalHeroLayout.module.scss"; | ||
import { ModalHeroLayoutProps } from "./ModalHeroLayout.types"; | ||
import Flex from "../../../Flex/Flex"; | ||
|
||
const ModalHeroLayout = forwardRef( | ||
( | ||
{ children, className, id, "data-testid": dataTestId }: ModalHeroLayoutProps, | ||
ref: React.ForwardedRef<HTMLDivElement> | ||
) => { | ||
const [media, header, content] = React.Children.toArray(children); | ||
|
||
return ( | ||
<Flex | ||
ref={ref} | ||
direction={Flex.directions.COLUMN} | ||
align={Flex.align.START} | ||
className={cx(styles.layout, className)} | ||
id={id} | ||
data-testid={dataTestId || getTestId(ComponentDefaultTestId.MODAL_NEXT_HERO_LAYOUT, id)} | ||
> | ||
<div className={styles.media}>{media}</div> | ||
<div className={styles.header}>{header}</div> | ||
<div className={styles.content}>{content}</div> | ||
</Flex> | ||
); | ||
} | ||
); | ||
|
||
export default ModalHeroLayout; |
6 changes: 6 additions & 0 deletions
6
packages/core/src/components/ModalNew/layouts/ModalHeroLayout/ModalHeroLayout.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from "react"; | ||
import { VibeComponentProps } from "../../../../types"; | ||
|
||
export interface ModalHeroLayoutProps extends VibeComponentProps { | ||
children: React.ReactNode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters