From ce20c62dc2225d44ac005ca7936e03bc2475aa8b Mon Sep 17 00:00:00 2001 From: abocsan-plenty <129151096+abocsan-plenty@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:33:32 +0200 Subject: [PATCH] feat: add zoom in image --- apps/web/components/Drift.vue | 75 +++++++++++++++++++++++++ apps/web/components/Gallery/Gallery.vue | 59 +++++++++++++------ package.json | 2 + yarn.lock | 16 ++++++ 4 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 apps/web/components/Drift.vue diff --git a/apps/web/components/Drift.vue b/apps/web/components/Drift.vue new file mode 100644 index 000000000..63d0e15e2 --- /dev/null +++ b/apps/web/components/Drift.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/apps/web/components/Gallery/Gallery.vue b/apps/web/components/Gallery/Gallery.vue index ea42346b9..686c3790b 100644 --- a/apps/web/components/Gallery/Gallery.vue +++ b/apps/web/components/Gallery/Gallery.vue @@ -1,8 +1,11 @@ @@ -127,6 +134,7 @@ import type { ImagesData } from '@plentymarkets/shop-api'; import { productImageGetters } from '@plentymarkets/shop-api'; import { defaults } from '~/composables'; +const mouse = ref(false); const props = defineProps<{ images: ImagesData[] }>(); const { isPending, start, stop } = useTimeoutFn(() => {}, 50); @@ -218,3 +226,18 @@ const assignReference = (element: Element | ComponentPublicInstance | null, inde if (index === 0) firstThumbReference.value = element as HTMLButtonElement; }; + + diff --git a/package.json b/package.json index fb44c7e61..02c826685 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,14 @@ "dependencies": { "@plentymarkets/shop-api": "^0.72.2", "@types/applepayjs": "^14.0.8", + "@types/drift-zoom": "^1.5.2", "@types/googlepay": "^0.7.6", "@vee-validate/nuxt": "^4.13.2", "@vee-validate/yup": "^4.13.2", "country-flag-icons": "^1.5.12", "cross-env": "^7.0.3", "dotenv": "^16.4.5", + "drift-zoom": "^1.5.1", "nuxt-swiper": "^1.2.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index b492b1c0b..72e312ef3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4239,6 +4239,7 @@ __metadata: "@paypal/paypal-js": 8.1.0 "@plentymarkets/shop-api": ^0.72.2 "@types/applepayjs": ^14.0.8 + "@types/drift-zoom": ^1.5.2 "@types/googlepay": ^0.7.6 "@types/uuid": ^9.0.8 "@vee-validate/nuxt": ^4.13.2 @@ -4253,6 +4254,7 @@ __metadata: cross-env: ^7.0.3 cypress-iframe: ^1.0.1 dotenv: ^16.4.5 + drift-zoom: ^1.5.1 happy-dom: ^14.12.3 husky: ^8.0.3 is-ci: ^3.0.1 @@ -4929,6 +4931,13 @@ __metadata: languageName: node linkType: hard +"@types/drift-zoom@npm:^1.5.2": + version: 1.5.2 + resolution: "@types/drift-zoom@npm:1.5.2" + checksum: 481bc258822acca5ef6092966c9f1c2eac19d749b1762e9086443777966a670be8d630968e40a71a53cc812cf146de1f10b7736cc95efc4a8809ded268f1bd4a + languageName: node + linkType: hard + "@types/estree@npm:*, @types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": version: 1.0.5 resolution: "@types/estree@npm:1.0.5" @@ -9930,6 +9939,13 @@ __metadata: languageName: node linkType: hard +"drift-zoom@npm:^1.5.1": + version: 1.5.1 + resolution: "drift-zoom@npm:1.5.1" + checksum: 4a02c4196212137b2ef207116a142e221aa52399d3062b69e2bb9081a92050995179ddee2e0833c33fc773cc4aab9b0568d17f7ceabc2d4e727d8ca86a551d61 + languageName: node + linkType: hard + "duplexer@npm:^0.1.2": version: 0.1.2 resolution: "duplexer@npm:0.1.2"