-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ModalSideBySideLayout): side by side layout component for new Modal
- Loading branch information
1 parent
a3c0347
commit 9d43dca
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...e/src/components/ModalNew/layouts/ModalSideBySideLayout/ModalSideBySideLayout.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,25 @@ | ||
.layout { | ||
width: 100%; | ||
flex-grow: 1; | ||
overflow: hidden; | ||
|
||
.leftPane { | ||
height: 100%; | ||
width: 60%; | ||
padding-inline: var(--modal-inline-padding); | ||
|
||
.header { | ||
width: 100%; | ||
margin-block: var(--spacing-xl) var(--spacing-large); | ||
} | ||
|
||
.content { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.media { | ||
flex-shrink: 0; | ||
width: 40%; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...ages/core/src/components/ModalNew/layouts/ModalSideBySideLayout/ModalSideBySideLayout.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,32 @@ | ||
import React, { forwardRef } from "react"; | ||
import cx from "classnames"; | ||
import { getTestId } from "../../../../tests/test-ids-utils"; | ||
import { ComponentDefaultTestId } from "../../../../tests/constants"; | ||
import styles from "./ModalSideBySideLayout.module.scss"; | ||
import { ModalSideBySideLayoutProps } from "./ModalSideBySideLayout.types"; | ||
import Flex from "../../../Flex/Flex"; | ||
|
||
const ModalSideBySideLayout = forwardRef( | ||
( | ||
{ children, className, id, "data-testid": dataTestId }: ModalSideBySideLayoutProps, | ||
ref: React.ForwardedRef<HTMLDivElement> | ||
) => { | ||
const [header, content, media] = React.Children.toArray(children); | ||
return ( | ||
<Flex | ||
ref={ref} | ||
className={cx(styles.layout, className)} | ||
id={id} | ||
data-testid={dataTestId || getTestId(ComponentDefaultTestId.MODAL_NEXT_SIDE_BY_SIDE_LAYOUT, id)} | ||
> | ||
<Flex direction={Flex.directions.COLUMN} align={Flex.align.START} className={styles.leftPane}> | ||
<div className={styles.header}>{header}</div> | ||
<div className={styles.content}>{content}</div> | ||
</Flex> | ||
<div className={styles.media}>{media}</div> | ||
</Flex> | ||
); | ||
} | ||
); | ||
|
||
export default ModalSideBySideLayout; |
6 changes: 6 additions & 0 deletions
6
...core/src/components/ModalNew/layouts/ModalSideBySideLayout/ModalSideBySideLayout.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 { VibeComponentProps } from "../../../../types"; | ||
import React from "react"; | ||
|
||
export interface ModalSideBySideLayoutProps 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