Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add ZoomImage

Steven Teyd8ea025c8c0e
diff --git a/apps/web/package.json b/apps/web/package.json
index 214e219ea3..71efcff3fc 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -101,6 +101,7 @@
"react-highlight-words": "^0.20.0",
"react-hook-form": "^7.52.1",
"react-markdown": "^9.0.3",
+ "react-medium-image-zoom": "^5.3.0",
"react-pdf-tailwind": "^2.3.0",
"react-textarea-autosize": "^8.4.0",
"react-tweet": "^3.1.1",
diff --git a/apps/web/styles/globals.css b/apps/web/styles/globals.css
index 17dacf43b6..7a2524a73c 100644
--- a/apps/web/styles/globals.css
+++ b/apps/web/styles/globals.css
@@ -4,6 +4,11 @@
@tailwind components;
@tailwind utilities;
+/* Hide the react-medium-image-zoom unzoom button */
+[data-rmiz-btn-unzoom] {
+ visibility: hidden;
+}
+
code {
counter-reset: step;
counter-increment: step 0;
diff --git a/apps/web/ui/guides/guide.tsx b/apps/web/ui/guides/guide.tsx
index e673fcbe60..062d27aade 100644
--- a/apps/web/ui/guides/guide.tsx
+++ b/apps/web/ui/guides/guide.tsx
@@ -6,7 +6,7 @@ import Link from "next/link";
import { useParams, usePathname } from "next/navigation";
import { InstallStripeIntegrationButton } from "./install-stripe-integration-button";
import { guides, IntegrationType } from "./integrations";
-import { Markdown } from "./markdown";
+import { GuidesMarkdown } from "./markdown";
const integrationTypeToTitle: Record<IntegrationType, string> = {
"client-sdk": "Install client-side script",
@@ -64,7 +64,7 @@ export function Guide({ markdown }: { markdown: string }) {
selectedGuide.key.startsWith("stripe") && (
<InstallStripeIntegrationButton />
)}
- <Markdown>{markdown}</Markdown>
+ <GuidesMarkdown>{markdown}</GuidesMarkdown>
<Link
href={backHref}
diff --git a/apps/web/ui/guides/markdown.tsx b/apps/web/ui/guides/markdown.tsx
index 5a862cabd9..f8b4908a96 100644
--- a/apps/web/ui/guides/markdown.tsx
+++ b/apps/web/ui/guides/markdown.tsx
@@ -1,8 +1,10 @@
import { cn } from "@dub/utils";
import ReactMarkdown from "react-markdown";
+import "react-medium-image-zoom/dist/styles.css";
import remarkGfm from "remark-gfm";
+import { ZoomImage } from "../shared/zoom-image";
-export function Markdown({
+export function GuidesMarkdown({
children,
className,
components,
@@ -42,6 +44,7 @@ export function Markdown({
a: ({ node, ...props }) => (
<a {...props} target="_blank" rel="noopener noreferrer" />
),
+ img: ({ node, ...props }) => <ZoomImage {...props} />,
...components,
}}
remarkPlugins={[remarkGfm] as any}
diff --git a/apps/web/ui/partners/lander/blocks/image-block.tsx b/apps/web/ui/partners/lander/blocks/image-block.tsx
index 900d0d57e5..5f28caa91f 100644
--- a/apps/web/ui/partners/lander/blocks/image-block.tsx
+++ b/apps/web/ui/partners/lander/blocks/image-block.tsx
@@ -1,4 +1,5 @@
import { programLanderImageBlockSchema } from "@/lib/zod/schemas/program-lander";
+import { ZoomImage } from "@/ui/shared/zoom-image";
import { z } from "zod";
export function ImageBlock({
@@ -7,14 +8,11 @@ export function ImageBlock({
block: z.infer<typeof programLanderImageBlockSchema>;
}) {
return (
- <div className="py-4">
- <img
- src={block.data.url}
- alt={block.data.alt}
- width={block.data.width}
- height={block.data.height}
- className="block rounded-lg"
- />
- </div>
+ <ZoomImage
+ src={block.data.url}
+ alt={block.data.alt}
+ width={block.data.width}
+ height={block.data.height}
+ />
);
}
diff --git a/apps/web/ui/shared/zoom-image.tsx b/apps/web/ui/shared/zoom-image.tsx
new file mode 100644
index 0000000000..fcadb035b9
--- /dev/null
+++ b/apps/web/ui/shared/zoom-image.tsx
@@ -0,0 +1,20 @@
+"use client";
+
+import Zoom from "react-medium-image-zoom";
+import "react-medium-image-zoom/dist/styles.css";
+
+export function ZoomImage(
+ props: React.DetailedHTMLProps<
+ React.ImgHTMLAttributes<HTMLImageElement>,
+ HTMLImageElement
+ >,
+) {
+ return (
+ <Zoom
+ zoomMargin={45}
+ zoomImg={{ ...props, className: "rounded-lg border border-gray-200" }}
+ >
+ <img {...props} className="rounded-lg border border-gray-200" />
+ </Zoom>
+ );
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d4f907df1f..a9ffe112b7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -42,7 +42,7 @@ importers:
version: 1.0.7([email protected])
'@boxyhq/saml-jackson':
specifier: 1.41.0
'@chronark/zod-bird':
specifier: ^0.3.9
version: 0.3.9
@@ -292,9 +292,12 @@ importers:
react-markdown:
specifier: ^9.0.3
version: 9.0.3(@types/[email protected])([email protected])
+ react-medium-image-zoom:
+ specifier: ^5.3.0
react-pdf-tailwind:
specifier: ^2.3.0
react-textarea-autosize:
specifier: ^8.4.0
version: 8.4.0(@types/[email protected])([email protected])
@@ -394,7 +397,7 @@ importers:
version: 15.1.0([email protected])
tailwindcss:
specifier: ^3.4.4
tsx:
specifier: ^4.19.2
version: 4.19.2
@@ -476,10 +479,10 @@ importers:
version: 5.0.10
ts-node:
specifier: ^10.9.2
tsup:
specifier: ^6.7.0
type-fest:
specifier: ^4.26.1
version: 4.26.1
@@ -509,7 +512,7 @@ importers:
version: 18.2.0([email protected])
react-email:
specifier: ^2.1.6
resend:
specifier: ^4.0.0
@@ -541,7 +544,7 @@ importers:
version: link:../../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.6.2
@@ -581,7 +584,7 @@ importers:
version: link:../../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.6.2
@@ -628,7 +631,7 @@ importers:
devDependencies:
'@stripe/ui-extension-tools':
specifier: ^0.0.1
'@types/react':
specifier: ^19.0.2
version: 19.0.2
@@ -640,13 +643,13 @@ importers:
dependencies:
'@tailwindcss/container-queries':
specifier: ^0.1.1
'@tailwindcss/forms':
specifier: ^0.5.6
'@tailwindcss/typography':
specifier: ^0.5.9
tailwind-scrollbar-hide:
specifier: ^1.1.7
version: 1.1.7
@@ -656,7 +659,7 @@ importers:
devDependencies:
tailwindcss:
specifier: ^3.4.4
packages/tsconfig: {}
@@ -833,13 +836,13 @@ importers:
version: 18.2.0
tailwindcss:
specifier: ^3.4.4
tsconfig:
specifier: workspace:*
version: link:../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.1.6
@@ -891,7 +894,7 @@ importers:
version: link:../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.1.6
@@ -8833,6 +8836,12 @@ packages:
'@types/react': '>=18'
react: '>=18'
+ resolution: {integrity: sha512-RCIzVlsKqy3BYgGgYbolUfuvx0aSKC7YhX/IJGEp+WJxsqdIVYJHkBdj++FAj6VD7RiWj6VVmdCfa/9vJE9hZg==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
resolution: {integrity: sha512-RREimnynuF0WAsATdYWhJATY5oNAUp9Ib07JE3Pl5oQW07R5T002xjfXk06e9BPh50DvMm9qZkDglZ7u4xzySQ==}
@@ -11512,7 +11521,7 @@ snapshots:
'@opentelemetry/sdk-metrics': 1.30.1(@opentelemetry/[email protected])
'@opentelemetry/semantic-conventions': 1.29.0
dependencies:
'@aws-sdk/client-dynamodb': 3.758.0
'@aws-sdk/credential-providers': 3.758.0
@@ -11537,7 +11546,7 @@ snapshots:
reflect-metadata: 0.2.2
ripemd160: 2.0.2
sqlite3: 5.1.7
transitivePeerDependencies:
- '@google-cloud/spanner'
- '@mongodb-js/zstd'
@@ -12141,7 +12150,7 @@ snapshots:
jest-util: 27.5.1
slash: 3.0.0
dependencies:
'@jest/console': 27.5.1
'@jest/reporters': 27.5.1
@@ -12155,7 +12164,7 @@ snapshots:
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 27.5.1
- jest-config: 27.5.1([email protected]([email protected]))
jest-haste-map: 27.5.1
jest-message-util: 27.5.1
jest-regex-util: 27.5.1
@@ -14809,7 +14818,7 @@ snapshots:
react: 17.0.2
stripe: 13.11.0
dependencies:
'@types/jest': 28.1.8
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
@@ -14817,9 +14826,9 @@ snapshots:
eslint: 8.48.0
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.2([email protected])
jest-transform-stub: 2.0.0
typescript: 4.9.5
transitivePeerDependencies:
- '@babel/core'
@@ -14904,22 +14913,22 @@ snapshots:
dependencies:
defer-to-connect: 2.0.1
dependencies:
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
mini-svg-data-uri: 1.4.4
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
lodash.castarray: 4.4.0
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
postcss-selector-parser: 6.0.10
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
@@ -18232,16 +18241,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
- '@jest/core': 27.5.1([email protected]([email protected]))
'@jest/test-result': 27.5.1
'@jest/types': 27.5.1
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
import-local: 3.1.0
- jest-config: 27.5.1([email protected]([email protected]))
jest-util: 27.5.1
jest-validate: 27.5.1
prompts: 2.4.2
@@ -18253,7 +18262,7 @@ snapshots:
- ts-node
- utf-8-validate
dependencies:
'@babel/core': 7.24.5
'@jest/test-sequencer': 27.5.1
@@ -18280,7 +18289,7 @@ snapshots:
slash: 3.0.0
strip-json-comments: 3.1.1
optionalDependencies:
- ts-node: 10.9.2([email protected])
transitivePeerDependencies:
- bufferutil
- canvas
@@ -18604,11 +18613,11 @@ snapshots:
merge-stream: 2.0.0
supports-color: 8.1.1
dependencies:
- '@jest/core': 27.5.1([email protected]([email protected]))
import-local: 3.1.0
transitivePeerDependencies:
- bufferutil
- canvas
@@ -20002,69 +20011,61 @@ snapshots:
camelcase-css: 2.0.1
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.31
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.31
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.38
- dependencies:
- lilconfig: 2.1.0
- yaml: 1.10.2
- optionalDependencies:
- postcss: 8.4.38
-
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
- ts-node: 10.9.2(@types/[email protected])([email protected])
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
dependencies:
@@ -20291,7 +20292,7 @@ snapshots:
react: 19.0.0
scheduler: 0.25.0
dependencies:
'@babel/core': 7.24.5
'@babel/parser': 7.24.5
@@ -20331,7 +20332,7 @@ snapshots:
source-map-js: 1.0.2
stacktrace-parser: 0.1.10
tailwind-merge: 2.2.0
- tailwindcss: 3.4.0([email protected]([email protected]))
typescript: 5.1.6
transitivePeerDependencies:
- '@opentelemetry/api'
@@ -20380,10 +20381,15 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
+
dependencies:
'@react-pdf/renderer': 3.4.5([email protected])([email protected])
transitivePeerDependencies:
- encoding
- react
@@ -21299,7 +21305,7 @@ snapshots:
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -21318,7 +21324,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -21326,7 +21332,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -21345,7 +21351,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -21353,7 +21359,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -21372,7 +21378,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -21380,7 +21386,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -21399,7 +21405,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -21455,7 +21461,7 @@ snapshots:
ansi-escapes: 4.3.2
supports-hyperlinks: 2.3.0
dependencies:
'@jridgewell/trace-mapping': 0.3.25
jest-worker: 27.5.1
@@ -21548,11 +21554,11 @@ snapshots:
dependencies:
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest-util: 27.5.1
json5: 2.2.3
lodash.memoize: 4.1.2
@@ -21565,7 +21571,7 @@ snapshots:
'@types/jest': 28.1.8
babel-jest: 27.5.1(@babel/[email protected])
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -21579,14 +21585,14 @@ snapshots:
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 5.1.6
+ typescript: 4.9.5
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
optionalDependencies:
'@swc/core': 1.3.101(@swc/[email protected])
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -21600,13 +21606,14 @@ snapshots:
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 5.6.2
+ typescript: 5.1.6
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
optionalDependencies:
'@swc/core': 1.3.101(@swc/[email protected])
+ optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -21623,25 +21630,29 @@ snapshots:
typescript: 5.4.4
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
+ optionalDependencies:
+ '@swc/core': 1.3.101(@swc/[email protected])
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
+ '@types/node': 18.11.9
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 4.9.5
+ typescript: 5.6.2
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
- optional: true
+ optionalDependencies:
+ '@swc/core': 1.3.101(@swc/[email protected])
optionalDependencies:
@@ -21653,7 +21664,7 @@ snapshots:
dependencies:
bundle-require: 3.1.2([email protected])
cac: 6.7.14
@@ -21663,7 +21674,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 2.79.1
source-map: 0.8.0-beta.0
@@ -21677,7 +21688,7 @@ snapshots:
- supports-color
- ts-node
dependencies:
bundle-require: 3.1.2([email protected])
cac: 6.7.14
@@ -21687,7 +21698,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 2.79.1
source-map: 0.8.0-beta.0
@@ -21701,7 +21712,7 @@ snapshots:
- supports-color
- ts-node
dependencies:
bundle-require: 4.2.1([email protected])
cac: 6.7.14
@@ -21711,7 +21722,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 3.29.5
source-map: 0.8.0-beta.0
@@ -21725,31 +21736,7 @@ snapshots:
- supports-color
- ts-node
- dependencies:
- bundle-require: 4.2.1([email protected])
- cac: 6.7.14
- chokidar: 3.5.3
- debug: 4.3.4
- esbuild: 0.17.19
- execa: 5.1.1
- globby: 11.1.0
- joycon: 3.1.1
- resolve-from: 5.0.0
- rollup: 3.29.5
- source-map: 0.8.0-beta.0
- sucrase: 3.34.0
- tree-kill: 1.2.2
- optionalDependencies:
- '@swc/core': 1.3.101(@swc/[email protected])
- postcss: 8.4.38
- typescript: 5.6.2
- transitivePeerDependencies:
- - supports-color
- - ts-node
-
dependencies:
bundle-require: 4.2.1([email protected])
cac: 6.7.14
@@ -21759,7 +21746,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 3.29.5
source-map: 0.8.0-beta.0
@@ -21929,7 +21916,7 @@ snapshots:
dependencies:
is-typedarray: 1.0.0
dependencies:
'@sqltools/formatter': 1.2.5
ansis: 3.17.0
@@ -21952,7 +21939,7 @@ snapshots:
pg: 8.13.3
redis: 4.7.0
sqlite3: 5.1.7
- ts-node: 10.9.2(@types/[email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -22310,7 +22297,7 @@ snapshots:
neo-async: 2.6.2
schema-utils: 3.3.0
tapable: 2.2.1
- terser-webpack-plugin: 5.3.10(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])
watchpack: 2.4.0
webpack-sources: 3.2.3
transitivePeerDependencies: