Skip to content

Commit d99b69d

Browse files
pbennett1-godaddywcole1-godaddyampcode-com
authored
Storefront component enhancements - ProductGrid and ProductCard (#1236)
* Add pagination and allow productId for ProductCard * all productIds and categoryIds props for ProductGrid * add changeset * add product search component * fix nextjs vuln version * remove cart id state from cart component reload each render * fix: storefront components error handling, state, and types - Fix state update in render for ProductGrid - Improve error handling in ProductCard and Cart - Prevent useAddToCart from throwing unhandled errors - Fix type definitions and imports Amp-Thread-ID: https://ampcode.com/threads/T-be981313-a505-4db5-9398-9f351a0d0d76 Co-authored-by: Amp <amp@ampcode.com> * update latest react for vuln --------- Co-authored-by: Wes Cole <wcole1@godaddy.com> Co-authored-by: Amp <amp@ampcode.com>
1 parent 5faea55 commit d99b69d

36 files changed

+763
-94
lines changed

.changeset/major-turtles-shout.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@godaddy/localizations": patch
3+
"@godaddy/react": patch
4+
---
5+
6+
- Add filtering by `productIds` and `categoryIds` to ProductGrid
7+
- Add `productId` prop to ProductCard for single product rendering
8+
- Add pagination support to ProductGrid with `enablePagination` prop
9+
- Add translations for pagination controls

examples/nextjs/app/store/products.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
'use client';
22

3-
import { ProductGrid } from '@godaddy/react';
3+
import { ProductGrid, ProductSearch } from '@godaddy/react';
44
import { useCart } from './layout';
55

66
export default function ProductsPage() {
77
const { openCart } = useCart();
88

99
return (
1010
<div className='container mx-auto'>
11+
<div className='mb-6 max-w-md'>
12+
<ProductSearch />
13+
</div>
1114
<ProductGrid
15+
enablePagination
1216
getProductHref={sku => `/store/product/${sku}`}
1317
onAddToCartSuccess={openCart}
1418
/>

examples/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@tanstack/react-query": "^5.66.0",
1616
"@tanstack/react-query-devtools": "^5.76.1",
1717
"lucide-react": "^0.475.0",
18-
"next": "16.0.1",
18+
"next": "16.0.10",
1919
"react": "19.2.0",
2020
"react-dom": "19.2.0",
2121
"zod": "^3.24.1"

packages/localizations/src/deDe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,5 +384,8 @@ export const deDe = {
384384
remove: 'Entfernen',
385385
removing: 'Wird entfernt...',
386386
checkout: 'Zur Kasse',
387+
itemsPerPage: 'Artikel pro Seite:',
388+
search: 'Suchen',
389+
searchPlaceholder: 'Produkte suchen...',
387390
},
388391
};

packages/localizations/src/enIe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,8 @@ export const enIe = {
361361
remove: 'Remove',
362362
removing: 'Removing...',
363363
checkout: 'Checkout',
364+
itemsPerPage: 'Items per page:',
365+
search: 'Search',
366+
searchPlaceholder: 'Search products...',
364367
},
365368
};

packages/localizations/src/enUs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,8 @@ export const enUs = {
361361
remove: 'Remove',
362362
removing: 'Removing...',
363363
checkout: 'Checkout',
364+
itemsPerPage: 'Items per page:',
365+
search: 'Search',
366+
searchPlaceholder: 'Search products...',
364367
},
365368
};

packages/localizations/src/esAr.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,5 +367,8 @@ export const esAr = {
367367
remove: 'Eliminar',
368368
removing: 'Eliminando...',
369369
checkout: 'Pagar',
370+
itemsPerPage: 'Artículos por página:',
371+
search: 'Buscar',
372+
searchPlaceholder: 'Buscar productos...',
370373
},
371374
};

packages/localizations/src/esCl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,8 @@ export const esCl = {
369369
remove: 'Eliminar',
370370
removing: 'Eliminando...',
371371
checkout: 'Pagar',
372+
itemsPerPage: 'Artículos por página:',
373+
search: 'Buscar',
374+
searchPlaceholder: 'Buscar productos...',
372375
},
373376
};

packages/localizations/src/esCo.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,5 +367,8 @@ export const esCo = {
367367
remove: 'Eliminar',
368368
removing: 'Eliminando...',
369369
checkout: 'Pagar',
370+
itemsPerPage: 'Artículos por página:',
371+
search: 'Buscar',
372+
searchPlaceholder: 'Buscar productos...',
370373
},
371374
};

packages/localizations/src/esEs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,5 +372,8 @@ export const esEs = {
372372
remove: 'Eliminar',
373373
removing: 'Eliminando...',
374374
checkout: 'Pagar',
375+
itemsPerPage: 'Artículos por página:',
376+
search: 'Buscar',
377+
searchPlaceholder: 'Buscar productos...',
375378
},
376379
};

0 commit comments

Comments
 (0)