diff --git a/package-lock.json b/package-lock.json index 72ac238d..74f385cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29679,6 +29679,21 @@ "react-leaflet": "^4.x" } }, + "node_modules/react-medium-image-zoom": { + "version": "5.1.10", + "resolved": "https://registry.npmjs.org/react-medium-image-zoom/-/react-medium-image-zoom-5.1.10.tgz", + "integrity": "sha512-sgadFY5yH0sEz5lVs9NubiwbVrtUeKnH9YdzXYv+cblrP8WXj2TSyT6J3sPw0pM5dGKbpjXjePye+42yWV4OSg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/rpearce" + } + ], + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-refresh": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", @@ -36317,7 +36332,7 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "packages/opub-ui": { - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { "@ariakit/react": "^0.3.14", @@ -36359,6 +36374,7 @@ "react-hook-form": "^7.49.3", "react-leaflet": "^4.2.1", "react-leaflet-fullscreen": "^4.1.1", + "react-medium-image-zoom": "^5.1.10", "react-stately": "^3.21.0", "satori": "^0.10.11", "screenfull": "^6.0.2", diff --git a/packages/opub-ui/assets/base.css b/packages/opub-ui/assets/base.css index 47cc29fe..e0e75ae4 100644 --- a/packages/opub-ui/assets/base.css +++ b/packages/opub-ui/assets/base.css @@ -1,80 +1,81 @@ @import 'leaflet/dist/leaflet.css'; +@import 'react-medium-image-zoom/dist/styles.css'; body { - color: var(--text-default); - line-height: 150%; - box-sizing: border-box; - font-family: var(--primary-font); - --outline: 2px solid var(--text-interactive); - --outline-offset: 2px; + color: var(--text-default); + line-height: 150%; + box-sizing: border-box; + font-family: var(--primary-font); + --outline: 2px solid var(--text-interactive); + --outline-offset: 2px; } *, ::after, ::before { - box-sizing: border-box; + box-sizing: border-box; } *:focus { - outline: var(--outline); - outline-offset: var(--outline-offset); + outline: var(--outline); + outline-offset: var(--outline-offset); } *:focus:not(:focus-visible) { - outline: none; + outline: none; } *:focus-visible { - outline: var(--outline); - outline-offset: var(--outline-offset); + outline: var(--outline); + outline-offset: var(--outline-offset); } .sr-only:not(:where(:focus, :active, :focus-within)) { - clip: rect(0 0 0 0); - clip-path: inset(50%); - height: 1px; - overflow: hidden; - position: absolute; - white-space: nowrap; - width: 1px; + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; } [data-radix-popper-content-wrapper] { - z-index: var(--z-max, 999999) !important; + z-index: var(--z-max, 999999) !important; } .text-clamp { - line-height: 156%; - overflow: hidden; - -webkit-line-clamp: 1; - line-clamp: 3; - -webkit-box-orient: vertical; - display: -webkit-box; + line-height: 156%; + overflow: hidden; + -webkit-line-clamp: 1; + line-clamp: 3; + -webkit-box-orient: vertical; + display: -webkit-box; } .leaflet-container { - width: 100%; - height: 100%; - font-family: var(--primary-font); + width: 100%; + height: 100%; + font-family: var(--primary-font); } .opub-leaflet-popup .leaflet-popup-content-wrapper { - border-radius: var(--border-radius-5); - padding: var(--space-1) var(--space-4); - background-color: var(--background-solid-dark); - color: var(--text-onbg-default); + border-radius: var(--border-radius-5); + padding: var(--space-1) var(--space-4); + background-color: var(--background-solid-dark); + color: var(--text-onbg-default); } .opub-leaflet-popup .leaflet-popup-tip-container { - left: 30%; + left: 30%; } .opub-leaflet-popup .leaflet-popup-tip { - background-color: var(--background-solid-dark); + background-color: var(--background-solid-dark); } .opub-leaflet-popup .leaflet-popup-content { - margin: 0; - font-weight: 500; - font-size: var(--font-size-75); + margin: 0; + font-weight: 500; + font-size: var(--font-size-75); } diff --git a/packages/opub-ui/package.json b/packages/opub-ui/package.json index c2c0702f..8ef1d0cb 100644 --- a/packages/opub-ui/package.json +++ b/packages/opub-ui/package.json @@ -104,6 +104,7 @@ "react-hook-form": "^7.49.3", "react-leaflet": "^4.2.1", "react-leaflet-fullscreen": "^4.1.1", + "react-medium-image-zoom": "^5.1.10", "react-stately": "^3.21.0", "satori": "^0.10.11", "screenfull": "^6.0.2", diff --git a/packages/opub-ui/src/components/ShareDialog/ShareDialog.tsx b/packages/opub-ui/src/components/ShareDialog/ShareDialog.tsx index f40d1df0..2e116518 100644 --- a/packages/opub-ui/src/components/ShareDialog/ShareDialog.tsx +++ b/packages/opub-ui/src/components/ShareDialog/ShareDialog.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { IconShare } from '@tabler/icons-react'; +import { Controlled as Zoom } from 'react-medium-image-zoom'; import { cn } from '../../utils'; import { Button } from '../Button'; @@ -59,6 +60,9 @@ const ShareDialog = React.forwardRef( ref?: React.Ref ) => { const [isOpen, setIsOpen] = React.useState(false); + const [lockDialog, setLockDialog] = React.useState(false); + const [zoom, setZoom] = React.useState(false); + const { copyToClipboard, shareImage, apiSupport } = useScreenshot(); const isSupported = apiSupport(); @@ -93,7 +97,17 @@ const ShareDialog = React.forwardRef( return (
- + { + if (lockDialog) { + setZoom(false); + setLockDialog(false); + } else { + handleOpen(e); + } + }} + >