-
Notifications
You must be signed in to change notification settings - Fork 361
[Image] | (DX) | Remove ZoomService in favor of WB Modal #3009
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f77bd9f
[image-replace-zoom-with-modal] Replace zoom service with modal
nishasy 364335c
[image-replace-zoom-with-modal] docs(changeset): [Image] | (DX) | Rem…
nishasy 1abdf85
[image-replace-zoom-with-modal] Remove zoom service
nishasy 70f30c6
[image-replace-zoom-with-modal] Update snapshots
nishasy f463acf
[image-replace-zoom-with-modal] Remove cypress test since modal can b…
nishasy 4505f9e
[image-replace-zoom-with-modal] add unit tests
nishasy 1716d23
[image-replace-zoom-with-modal] Merge branch 'main' into image-replac…
nishasy e9715a3
[image-replace-zoom-with-modal] style comments
nishasy 0db2ecc
[image-replace-zoom-with-modal] Use components as components rather t…
nishasy 656a40d
[image-replace-zoom-with-modal] Allow zoomed image to touches edges o…
nishasy b91e0e5
[image-replace-zoom-with-modal] Make required
nishasy c4abc1a
[image-replace-zoom-with-modal] remove unused styles
nishasy 6fda1ca
[image-replace-zoom-with-modal] Add a test for zoom behavior within e…
nishasy fc6876d
[image-replace-zoom-with-modal] I think this is a minor change
nishasy 0648b69
[image-replace-zoom-with-modal] Move comment
nishasy 4cd5f80
[image-replace-zoom-with-modal] Merge branch 'main' into image-replac…
nishasy aa8d559
[image-replace-zoom-with-modal] Merge branch 'main' into image-replac…
nishasy 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
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@khanacademy/perseus": minor | ||
| --- | ||
|
|
||
| [Image] | (DX) | Remove ZoomService in favor of WB Modal |
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import Clickable from "@khanacademy/wonder-blocks-clickable"; | ||
| import {ModalLauncher} from "@khanacademy/wonder-blocks-modal"; | ||
| import * as React from "react"; | ||
|
|
||
| import {usePerseusI18n} from "./i18n-context"; | ||
| import {ZoomedImageView} from "./zoomed-image-view"; | ||
|
|
||
| type Props = { | ||
| imgElement: React.ReactNode; | ||
| imgSrc: string; | ||
| width?: number; | ||
| height?: number; | ||
| }; | ||
|
|
||
| export const ZoomImageButton = ({imgElement, imgSrc, width, height}: Props) => { | ||
| const i18n = usePerseusI18n(); | ||
|
|
||
| return ( | ||
| <ModalLauncher | ||
| modal={({closeModal}) => ( | ||
| <ZoomedImageView | ||
| imgElement={imgElement} | ||
| imgSrc={imgSrc} | ||
| onClose={closeModal} | ||
| /> | ||
| )} | ||
| > | ||
| {({openModal}) => ( | ||
| <Clickable | ||
| aria-label={i18n.strings.imageZoomAriaLabel} | ||
| onClick={openModal} | ||
| // TODO(LEMS-3686): Use CSS modules after Wonder Blocks | ||
| // supports it instead of inline styles. | ||
| style={{ | ||
| // Overlay the button over the image. | ||
| position: "absolute", | ||
| width: width ?? "100%", | ||
| height: height, | ||
| overflow: "hidden", | ||
| cursor: "zoom-in", | ||
| }} | ||
| > | ||
| {() => { | ||
| return <React.Fragment />; | ||
| }} | ||
| </Clickable> | ||
| )} | ||
| </ModalLauncher> | ||
| ); | ||
| }; | ||
14 changes: 14 additions & 0 deletions
14
packages/perseus/src/components/zoomed-image-view.module.css
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| .contentWrapper { | ||
| /* Undo the ModalContent padding so that the image takes up the whole modal. */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for these comments! |
||
| margin-block: calc(-1 * var(--wb-c-modal-panel-layout-gap-default)); | ||
| margin-inline: calc(-1 * var(--wb-c-modal-panel-layout-gap-default)); | ||
| /* Remove inline spacing that creates a 1px gap below images */ | ||
| line-height: 0; | ||
| } | ||
|
|
||
| @media (max-width: 767px) { | ||
| .contentWrapper { | ||
| /* Smaller screens have a smaller inline gap */ | ||
| margin-inline: calc(-1 * var(--wb-c-modal-panel-layout-gap-small)); | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.