Skip to content

Commit c6bcf3e

Browse files
authored
Added react-medium-image-zoom (#33)
* Added react-medium-image-zoom * Updated CHANGELOG.md
1 parent ae8f89d commit c6bcf3e

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Products/WorldCoin State Replication:
2020
- Updated the relayer version in the replication guide;
2121
- Used `@docusaurus/plugin-ideal-image` for image optimization
22+
- Used `react-medium-image-zoom` to zoom images
2223

2324
## [2.0.5] - 23-02-2024
2425

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"react": "^18.2.0",
3131
"react-dom": "^18.2.0",
3232
"react-live": "^4.1.5",
33+
"react-medium-image-zoom": "4.4.3",
3334
"redocusaurus": "^2.0.0",
3435
"remark-emoji": "^4.0.1",
3536
"swiper": "^11.0.5"

src/components/IdealImage/index.tsx

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import Image, { Props as ImageProps } from '@theme/IdealImage'
22
import React from 'react'
3-
43
import styles from './styles.module.css'
4+
import Zoom from 'react-medium-image-zoom'
5+
import 'react-medium-image-zoom/dist/styles.css'
6+
57

68
export default function IdealImage({ img, alt, ...rest }: ImageProps) {
79
return (
8-
<Image
9-
className={styles.idealImage}
10-
// @ts-expect-error: `shouldAutoDownload` is not in the type definition
11-
shouldAutoDownload={() => true}
12-
img={img}
13-
alt={alt}
14-
{...rest}
15-
/>
10+
<Zoom>
11+
<Image
12+
className={styles.idealImage}
13+
// @ts-expect-error: `shouldAutoDownload` is not in the type definition
14+
shouldAutoDownload={() => true}
15+
img={img}
16+
alt={alt}
17+
{...rest}
18+
/>
19+
</Zoom>
1620
)
1721
}

src/components/IdealImage/styles.module.css

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
margin-bottom: var(--ifm-paragraph-margin-bottom);
33
}
44

5+
[data-theme='dark'] [data-rmiz-overlay] {
6+
background-color: rgba(50, 50, 50, 0.95) !important;
7+
}
8+

yarn.lock

+14-1
Original file line numberDiff line numberDiff line change
@@ -5334,6 +5334,11 @@ flatted@^3.2.9:
53345334
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
53355335
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==
53365336

5337+
focus-options-polyfill@1.5.1:
5338+
version "1.5.1"
5339+
resolved "https://registry.yarnpkg.com/focus-options-polyfill/-/focus-options-polyfill-1.5.1.tgz#0f422580d9d1fb65651f2968b547032eb17dab3c"
5340+
integrity sha512-7yH20IePROHJLLbJvqqtsG420jE6DuukccapiB/WagtUpnc98r9NzHbX5rnjCDgdZqLgcqlzGjn+8l0Zb8Zf9w==
5341+
53375342
follow-redirects@^1.0.0:
53385343
version "1.15.5"
53395344
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
@@ -9198,6 +9203,14 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
91989203
dependencies:
91999204
"@babel/runtime" "^7.10.3"
92009205

9206+
react-medium-image-zoom@4.4.3:
9207+
version "4.4.3"
9208+
resolved "https://registry.yarnpkg.com/react-medium-image-zoom/-/react-medium-image-zoom-4.4.3.tgz#d5e3074becef7be4bfe35ebcd291eac462093bf5"
9209+
integrity sha512-I928Z6mEMRUup4CPa+XtASiSuFzdVb1ecztXpF7xAJddXv4XZSE4n5gleZNYCn5wEU1LQY5LiN4aNW4KgrOVIA==
9210+
dependencies:
9211+
focus-options-polyfill "1.5.1"
9212+
tslib "^2.4.0"
9213+
92019214
react-router-config@^5.1.1:
92029215
version "5.1.1"
92039216
resolved "https://registry.yarnpkg.com/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988"
@@ -10577,7 +10590,7 @@ tslib@^1.8.1:
1057710590
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
1057810591
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
1057910592

10580-
tslib@^2.0.3, tslib@^2.6.0:
10593+
tslib@^2.0.3, tslib@^2.4.0, tslib@^2.6.0:
1058110594
version "2.6.2"
1058210595
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
1058310596
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

0 commit comments

Comments
 (0)