-
Notifications
You must be signed in to change notification settings - Fork 1
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
P-Gill97
wants to merge
146
commits into
main
Choose a base branch
from
image-preview
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
146 commits
Select commit
Hold shift + click to select a range
45726f7
Create media modal component
P-Gill97 f5b7536
Add expand image message on mobile breakpoint
P-Gill97 f788ab5
Add onMediaClick event and modal integration
P-Gill97 1909c27
Fix linter issues
P-Gill97 713fcc5
Merge branch 'main' into image-preview
P-Gill97 7353861
Finish MediaModal style
P-Gill97 97e29f4
Use modal manager and add accessibility
P-Gill97 cb31fc4
Merge branch 'main' into image-preview
P-Gill97 a9e23de
Fix conflict bug
P-Gill97 3a088ca
Remove old state logic
P-Gill97 89c6ded
Fix linter errors
P-Gill97 e1720dc
Update snapshots and styles
P-Gill97 adc0207
Fix opacity for background color
P-Gill97 48a5d0c
Add tests and update components
P-Gill97 178e7bc
update media modal style
TomWoodward 1b691f4
use full size image in media dialog
TomWoodward 532aec9
fix image height thing
TomWoodward a3273ac
use original image width
TomWoodward 9c92f68
Update media modal manager implementation
P-Gill97 edb751b
Fix pointer event issue and add role
P-Gill97 3a73905
Update page component to use new modalManager
P-Gill97 f6c028a
Update specs and manager
P-Gill97 b0722f0
Merge branch 'main' into image-preview
P-Gill97 c3e07d9
Add removed comment
P-Gill97 ac11a97
Merge branch 'main' into image-preview
P-Gill97 77eff7a
Merge branch 'image-preview' of github.com:openstax/rex-web into imag…
P-Gill97 9eeaf12
Update label with alt text
P-Gill97 7150543
Refactor test
P-Gill97 05c0a01
Remove redundant window check
P-Gill97 a02e331
Merge branch 'main' into image-preview
staxly[bot] b27c170
Merge branch 'main' into image-preview
staxly[bot] cd496fd
Merge branch 'main' into image-preview
staxly[bot] 8ee7fb5
Merge branch 'main' into image-preview
staxly[bot] d14563a
Merge branch 'main' into image-preview
staxly[bot] 56679aa
Merge branch 'main' into image-preview
staxly[bot] e0e0e03
Merge branch 'main' into image-preview
staxly[bot] 19f6d69
Merge branch 'main' into image-preview
staxly[bot] 2da15d1
Merge branch 'main' into image-preview
staxly[bot] 338734a
Merge branch 'main' into image-preview
staxly[bot] da94778
Merge branch 'main' into image-preview
staxly[bot] ef500b8
Merge branch 'main' into image-preview
staxly[bot] 7dabf30
Merge branch 'main' into image-preview
staxly[bot] a5a754e
Merge branch 'main' into image-preview
staxly[bot] 22e2e25
Merge branch 'main' into image-preview
staxly[bot] 7f99e7d
Merge branch 'main' into image-preview
staxly[bot] 9ccc7c9
Merge branch 'main' into image-preview
staxly[bot] 8c87404
Merge branch 'main' into image-preview
staxly[bot] 8ca0ea0
Merge branch 'main' into image-preview
staxly[bot] 89c451b
Merge branch 'main' into image-preview
staxly[bot] e56810d
Merge branch 'main' into image-preview
staxly[bot] 2649e67
Merge branch 'main' into image-preview
staxly[bot] 1ca3195
Merge branch 'main' into image-preview
staxly[bot] ffcae6a
Merge branch 'main' into image-preview
staxly[bot] 422f8b7
Merge branch 'main' into image-preview
staxly[bot] dac844e
Merge branch 'main' into image-preview
staxly[bot] f087090
Merge branch 'main' into image-preview
staxly[bot] 5a4d541
Merge branch 'main' into image-preview
staxly[bot] 9d1738f
Merge branch 'main' into image-preview
staxly[bot] f393ba9
Merge branch 'main' into image-preview
staxly[bot] f94b264
Merge branch 'main' into image-preview
staxly[bot] d4e3138
Merge branch 'main' into image-preview
staxly[bot] e7ccc2a
Merge branch 'main' into image-preview
staxly[bot] 63e9f5e
Merge branch 'main' into image-preview
staxly[bot] 17271e2
Merge branch 'main' into image-preview
staxly[bot] 22b59c9
Merge branch 'main' into image-preview
staxly[bot] 3764f95
Merge branch 'main' into image-preview
staxly[bot] b660403
Merge branch 'main' into image-preview
staxly[bot] 9735f70
Merge branch 'main' into image-preview
staxly[bot] 9357026
Merge branch 'main' into image-preview
staxly[bot] 1ffde53
Update dom to use button for media interactive content
P-Gill97 9fd0d77
Merge branch 'image-preview' of github.com:openstax/rex-web into imag…
P-Gill97 bb7b2c0
Update snapshot
P-Gill97 013d467
Update page component and mediaModalManager
P-Gill97 0b4599a
Change enhanceImagesForAccessibility function signature
P-Gill97 3415cf6
Merge branch 'main' into image-preview
staxly[bot] 5f36c56
Update EXPECTED_SCROLL_TOPS values
P-Gill97 ae55483
Merge branch 'image-preview' of github.com:openstax/rex-web into imag…
P-Gill97 9ba613e
Update EXPECTED_SCROLL_TOPS to match CI
P-Gill97 aa37c3c
Match CI test output
P-Gill97 5c88fb7
Merge branch 'main' into image-preview
staxly[bot] 40b37d0
Merge branch 'main' into image-preview
staxly[bot] df0625c
Merge branch 'main' into image-preview
staxly[bot] d40b383
Merge branch 'main' into image-preview
staxly[bot] 622c51c
Merge branch 'main' into image-preview
staxly[bot] f873229
Merge branch 'main' into image-preview
staxly[bot] 7e56d2a
Merge branch 'main' into image-preview
staxly[bot] 2b1facb
Merge branch 'main' into image-preview
staxly[bot] 472af21
Merge branch 'main' into image-preview
staxly[bot] 4c329bc
Merge branch 'main' into image-preview
staxly[bot] 76b138c
Merge branch 'main' into image-preview
staxly[bot] ee739a2
Merge branch 'main' into image-preview
staxly[bot] 615f1c4
Merge branch 'main' into image-preview
staxly[bot] 2869de9
Merge branch 'main' into image-preview
staxly[bot] 05c7085
Merge branch 'main' into image-preview
staxly[bot] 4294add
Merge branch 'main' into image-preview
staxly[bot] 4ec6f0d
Merge branch 'main' into image-preview
staxly[bot] 664fe18
Merge branch 'main' into image-preview
staxly[bot] 8c74631
Merge branch 'main' into image-preview
staxly[bot] 07c6153
Merge branch 'main' into image-preview
staxly[bot] 1c35c23
Merge branch 'main' into image-preview
staxly[bot] 915f6e6
Merge branch 'main' into image-preview
staxly[bot] de668c3
Merge branch 'main' into image-preview
staxly[bot] 6aee41d
Merge branch 'main' into image-preview
staxly[bot] af498d8
Merge branch 'main' into image-preview
staxly[bot] b8552dc
Merge branch 'main' into image-preview
staxly[bot] 016f43d
Merge branch 'main' into image-preview
staxly[bot] 34744ee
Merge branch 'main' into image-preview
staxly[bot] 754bb31
Merge branch 'main' into image-preview
staxly[bot] f1478b1
Merge branch 'main' into image-preview
staxly[bot] 9623bc9
Merge branch 'main' into image-preview
staxly[bot] d10bd25
Merge branch 'main' into image-preview
staxly[bot] 5ecd665
Merge branch 'main' into image-preview
staxly[bot] c303af9
Update tests
P-Gill97 f00e146
Refactor modal manager
P-Gill97 c1e9f7d
Merge branch 'image-preview' of github.com:openstax/rex-web into imag…
P-Gill97 1e66835
Fix linter errors
P-Gill97 57e3245
Add test and change EXPECTED_SCROLL_TOPS
P-Gill97 9ea208c
Update browser spec
P-Gill97 289040e
Match CI EXPECTED_SCROLL_TOPS
P-Gill97 d595b3c
Update EXPECTED_SCROLL_TOPS again
P-Gill97 603225d
Merge branch 'main' into image-preview
staxly[bot] b1397fe
Merge branch 'main' into image-preview
staxly[bot] 5207d84
Merge branch 'main' into image-preview
staxly[bot] c6df875
Merge branch 'main' into image-preview
staxly[bot] f7c93a5
Merge branch 'main' into image-preview
staxly[bot] 7d78498
Merge branch 'main' into image-preview
staxly[bot] 7c53bae
Merge branch 'main' into image-preview
staxly[bot] 2b5b009
Merge branch 'main' into image-preview
staxly[bot] 9755b5e
Merge branch 'main' into image-preview
staxly[bot] 6fa3274
Merge branch 'main' into image-preview
staxly[bot] a557b76
Merge branch 'main' into image-preview
staxly[bot] 2407a4c
Merge branch 'main' into image-preview
staxly[bot] 0057d4e
Merge branch 'main' into image-preview
staxly[bot] 88af331
Merge branch 'main' into image-preview
staxly[bot] e942ea3
Merge branch 'main' into image-preview
staxly[bot] a50b1c8
Merge branch 'main' into image-preview
staxly[bot] dd83ed5
Merge branch 'main' into image-preview
staxly[bot] 72fd9a1
Merge branch 'main' into image-preview
staxly[bot] 1443cd6
Merge branch 'main' into image-preview
staxly[bot] f2531b0
Merge branch 'main' into image-preview
staxly[bot] cae5071
Merge branch 'main' into image-preview
staxly[bot] eeb7b14
Merge branch 'main' into image-preview
staxly[bot] 7b32195
Merge branch 'main' into image-preview
staxly[bot] bd284c3
Merge branch 'main' into image-preview
staxly[bot] 816a8ee
Merge branch 'main' into image-preview
staxly[bot] db3e90b
Merge branch 'main' into image-preview
staxly[bot] 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
update media modal style
- Loading branch information
commit 178e7bcdb6df839dc41e23e2db27787e1139f0a3
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,60 +1,48 @@ | ||
| import React from 'react'; | ||
| import styled from 'styled-components/macro'; | ||
| import ScrollLock from '../../../components/ScrollLock'; | ||
| import theme from '../../../theme'; | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const Overlay = styled.div` | ||
| position: fixed; | ||
| inset: 0; | ||
| background-color: rgba(0, 0, 0, 0.9); | ||
| z-index: 1000; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| `; | ||
| const buttonHeight = 4.2; // rem | ||
| const buttonMargin = 0.5; // rem | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const Modal = styled.div` | ||
| const ScrollableContent = styled.div` | ||
| background: white; | ||
| width: 100%; | ||
| min-width: 100vw; | ||
| max-height: 90vh; | ||
| box-sizing: border-box; | ||
| display: flex; | ||
| flex-direction: column; | ||
| position: relative; | ||
| overflow: hidden; | ||
| max-width: 100vw; | ||
| max-height: calc(100vh - ${(buttonHeight + buttonMargin * 2) * 2}rem); | ||
| overflow: auto; | ||
| `; | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const ScrollableContent = styled.div` | ||
| overflow-y: auto; | ||
| display: block; | ||
| width: 100%; | ||
| box-sizing: border-box; | ||
| `; | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const FloatingCloseButton = styled.button` | ||
| position: absolute; | ||
| top: -3rem; | ||
| right: 2.5rem; | ||
| top: -${buttonHeight + buttonMargin}rem; | ||
| right: ${buttonMargin}rem; | ||
| z-index: 10; | ||
| background: none; | ||
| border: none; | ||
| padding: 0; | ||
| cursor: pointer; | ||
| width: 2.5rem; | ||
| height: 2.5rem; | ||
| transform: translateY(-3rem); | ||
| width: ${buttonHeight}rem; | ||
| height: ${buttonHeight}rem; | ||
| `; | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const ModalWrapper = styled.div` | ||
| const ContentContainer = styled.div` | ||
| position: relative; | ||
| max-width: 100vw; | ||
| width: 100%; | ||
| box-sizing: border-box; | ||
| `; | ||
|
|
||
| // tslint:disable-next-line:variable-name | ||
| const ModalWrapper = styled.div` | ||
| position: fixed; | ||
| inset: 0; | ||
| overflow: hidden; | ||
| z-index: ${theme.zIndex.highlightSummaryPopup + 1}; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| `; | ||
|
|
||
|
|
||
|
|
@@ -78,17 +66,19 @@ const MediaModal: React.FC<MediaModalProps> = ({ isOpen, onClose, children }) => | |
|
|
||
| return ( | ||
| <> | ||
| <ScrollLock onClick={onClose} overlay={true} /> | ||
| <Overlay onClick={onClose}> | ||
| <ModalWrapper aria-modal='true'> | ||
| <ScrollLock | ||
| onClick={onClose} | ||
| overlay={true} | ||
| zIndex={theme.zIndex.highlightSummaryPopup} | ||
| /> | ||
| <ModalWrapper aria-modal='true'> | ||
|
||
| <ContentContainer> | ||
| <FloatingCloseButton onClick={onClose} aria-label='Close media preview'> | ||
| <CloseIcon /> | ||
| </FloatingCloseButton> | ||
| <Modal> | ||
| <ScrollableContent>{children}</ScrollableContent> | ||
| </Modal> | ||
| </ModalWrapper> | ||
| </Overlay> | ||
| <ScrollableContent>{children}</ScrollableContent> | ||
| </ContentContainer> | ||
| </ModalWrapper> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
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