@pradip1995/segment-product-card 0.3.17 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/segment-product-card",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,6 +17,10 @@
17
17
  "./product-scroll": "./src/product-scroll.tsx",
18
18
  "./product-rail-variants": "./src/product-rail-variants.tsx"
19
19
  },
20
+ "scripts": {
21
+ "typecheck": "tsc --noEmit",
22
+ "lint": "tsc --noEmit"
23
+ },
20
24
  "peerDependencies": {
21
25
  "@pradip1995/commerce-core": "^4.0.0",
22
26
  "@pradip1995/plugin-sdk": "^0.2.0",
@@ -33,9 +37,5 @@
33
37
  "@types/react": "^19",
34
38
  "react": "19.0.3",
35
39
  "typescript": "^5.7.2"
36
- },
37
- "scripts": {
38
- "typecheck": "tsc --noEmit",
39
- "lint": "tsc --noEmit"
40
40
  }
41
- }
41
+ }
@@ -2,14 +2,19 @@ import type { HttpTypes } from "@medusajs/types"
2
2
  import { resolveMediaUrl } from "@pradip1995/segment-primitives/resolve-media-url"
3
3
 
4
4
  export function resolveProductCardImages(product: HttpTypes.StoreProduct) {
5
- const images =
5
+ const gallery =
6
6
  product.images
7
7
  ?.map((image) => resolveMediaUrl(image.url))
8
8
  .filter((url): url is string => !!url) ?? []
9
9
 
10
+ const variantImages = (product.variants ?? [])
11
+ .map((variant) => resolveMediaUrl((variant as { thumbnail?: string | null }).thumbnail))
12
+ .filter((url): url is string => !!url)
13
+
14
+ const images = [...gallery, ...variantImages]
10
15
  const thumbnail = resolveMediaUrl(product.thumbnail) || ""
11
16
  const primary = thumbnail || images[0] || ""
12
- const hover = images.find((url) => url && url !== primary) || ""
17
+ const hover = [...new Set(images)].find((url) => url && url !== primary) || ""
13
18
 
14
19
  return { primary, hover }
15
20
  }
package/src/segment.css CHANGED
@@ -246,10 +246,15 @@
246
246
  width: 100%;
247
247
  height: 100%;
248
248
  object-fit: cover;
249
- transition: opacity 0.4s ease;
249
+ transition: opacity 0.45s ease, transform 0.55s ease;
250
+ }
251
+
252
+ .jewelry-product-card__image--primary {
253
+ z-index: 1;
250
254
  }
251
255
 
252
256
  .jewelry-product-card__image--hover {
257
+ z-index: 2;
253
258
  opacity: 0;
254
259
  }
255
260
 
@@ -257,10 +262,14 @@
257
262
  opacity: 1;
258
263
  }
259
264
 
260
- .jewelry-product-card__media--has-hover:hover .jewelry-product-card__image--primary {
265
+ .jewelry-product-card:hover .jewelry-product-card__media--has-hover .jewelry-product-card__image--primary {
261
266
  opacity: 0;
262
267
  }
263
268
 
269
+ .jewelry-product-card:hover .jewelry-product-card__media:not(.jewelry-product-card__media--has-hover) .jewelry-product-card__image--primary {
270
+ transform: scale(1.06);
271
+ }
272
+
264
273
  .jewelry-product-card__placeholder {
265
274
  background: linear-gradient(135deg, var(--color-surface-muted) 0%, var(--color-surface-alt) 100%);
266
275
  }
@@ -288,14 +297,16 @@
288
297
  }
289
298
 
290
299
  .jewelry-product-card .product-card__quick-add-wrap {
291
- left: 0;
292
- right: 0;
293
- bottom: 0;
300
+ left: 0.75rem;
301
+ right: 0.75rem;
302
+ bottom: 0.75rem;
294
303
  top: auto;
304
+ z-index: 12;
305
+ padding: 0;
295
306
  opacity: 0;
296
- transform: translateY(100%);
307
+ transform: translateY(0.5rem);
297
308
  pointer-events: none;
298
- transition: opacity 0.25s ease, transform 0.25s ease;
309
+ transition: opacity 0.28s ease, transform 0.28s ease;
299
310
  }
300
311
 
301
312
  .jewelry-product-card:hover .product-card__quick-add-wrap {
@@ -306,19 +317,23 @@
306
317
 
307
318
  .jewelry-product-card .product-card__quick-add {
308
319
  width: 100%;
309
- border-radius: 0;
310
- background: rgba(26, 26, 26, 0.88);
311
- color: var(--color-text-inverse);
312
- letter-spacing: 0.08em;
320
+ border-radius: 999px;
321
+ border: 1px solid var(--color-footer-bg, #45355e);
322
+ background: var(--color-footer-bg, #45355e);
323
+ color: #ffffff;
324
+ letter-spacing: 0.12em;
313
325
  text-transform: uppercase;
314
326
  font-size: 0.6875rem;
315
327
  font-weight: 600;
316
- min-height: 2.75rem;
317
- backdrop-filter: blur(4px);
328
+ min-height: 2.5rem;
329
+ box-shadow: 0 8px 22px rgba(69, 53, 94, 0.22);
318
330
  }
319
331
 
320
- .jewelry-product-card .product-card__quick-add:hover:not(:disabled) {
321
- background: var(--color-brand-primary);
332
+ .jewelry-product-card .product-card__quick-add:hover:not(:disabled),
333
+ .jewelry-product-card .product-card__quick-add:focus-visible:not(:disabled) {
334
+ background: var(--color-footer-bg, #45355e);
335
+ border-color: var(--color-footer-bg, #45355e);
336
+ color: #ffffff;
322
337
  }
323
338
 
324
339
  .jewelry-product-card .product-card__quick-add-label {
@@ -368,12 +383,14 @@
368
383
  }
369
384
 
370
385
  .product-scroll__slide:has(.jewelry-product-card) {
371
- flex: 0 0 clamp(210px, 38vw, 280px);
386
+ flex: 0 0 calc((100cqw - 0.75rem) / 1.2);
387
+ width: calc((100cqw - 0.75rem) / 1.2);
372
388
  }
373
389
 
374
390
  @media (min-width: 768px) {
375
391
  .product-scroll__slide:has(.jewelry-product-card) {
376
392
  flex: 0 0 clamp(240px, 22vw, 280px);
393
+ width: auto;
377
394
  }
378
395
  }
379
396