Skip to content

Image preview modal for mobile breakpoint #2470

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

Open
wants to merge 79 commits into
base: main
Choose a base branch
from
Open

Conversation

P-Gill97
Copy link

@P-Gill97 P-Gill97 commented May 5, 2025

@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-wka1pcen May 5, 2025 07:34 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 12, 2025 22:20 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 12, 2025 22:30 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 15:09 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 15:45 Inactive
overlay={true}
zIndex={theme.zIndex.highlightSummaryPopup}
/>
<ModalWrapper aria-modal='true'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also have role=dialog?


export function MediaModalPortal(): React.ReactPortal | null {
const [isOpen, setIsOpen] = React.useState(false);
const [modalContent, setModalContent] = React.useState<ReactNode>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to handle esc to close

const setClosed = React.useCallback(() => setIsOpen(false), [setIsOpen]);
useOnEsc(isOpen, setClosed);

`;

// tslint:disable-next-line:variable-name
const ModalWrapper = styled.div`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sorta needs to be taking up the whole screen so that it can center things properly, but its gobbling click events so clicking on the overlay isn't closing things. i think you can set a css prop on here to allow click events to pass through and that'll fix it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole MediaModalManger setup is pretty convoluted, can you look at the highlightManager and try to share some of the patterns?

don't need the singleton class. stylistically, would be more consistent if it was a function and not a class. PageComponent can construct the manager and store the manager reference

PageComponent should orchestrate managers but there shouldn't be any business logic in there, move all the event listeners into the manager, you can bind your listener to the page component element instead of each individual image so that you don't have to re-apply the listeners when the content changes

@@ -149,6 +147,7 @@ export default class PageComponent extends Component<PagePropTypes> {
return <MinPageHeight>
<this.highlightManager.CardList />
<PT />
<MediaModalPortal />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you look above, the CardList is coming from the manager so that you don't need all the wonky binding logic. if you prefer, you could leave the component separate and pass the manager into it as a prop here, but either of those approaches would be more clear than the singleton binding its doing now

@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 16:22 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 17, 2025 01:17 Inactive
staxly bot and others added 29 commits July 10, 2025 20:54
@P-Gill97 P-Gill97 requested a review from TomWoodward July 16, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants