-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ModalMediaLayout): layout with top media for new Modal #2465
Merged
YossiSaadi
merged 4 commits into
feat/yossi/new-modal-layouts
from
feat/yossi/new-modal-hero-layout-7360990175
Oct 20, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4722c58
feat(ModalHeroLayout): hero layout component for new Modal
YossiSaadi fcf0fb0
feat(ModalHeroLayout): image responsiveness (only medium size currently)
YossiSaadi 6df9cd8
feat(ModalMediaLayout): change component name
YossiSaadi 9741fb2
build: fix constant name
YossiSaadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.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,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; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.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 "./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<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_MEDIA_LAYOUT, id)} | ||
> | ||
<div className={styles.media}>{media}</div> | ||
<div className={styles.header}>{header}</div> | ||
<div className={styles.content}>{content}</div> | ||
</Flex> | ||
); | ||
} | ||
); | ||
|
||
export default ModalMediaLayout; |
6 changes: 6 additions & 0 deletions
6
packages/core/src/components/ModalNew/layouts/ModalMediaLayout/ModalMediaLayout.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 ModalMediaLayoutProps 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's an image? object-fit needed? Will be used externally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be supplied through recommended ModalMedia. if users don't want to use ModalMedia for some reason they'll be responsible for stretching the image