@@ -199,6 +199,12 @@ export default function AdminProductList() {
199
199
{ /* Product grid */ }
200
200
< div className = "lg:col-span-3" >
201
201
{ /* This is our products list */ }
202
+ < Link
203
+ to = "/admin/product-form"
204
+ className = "rounded-md mx-10 bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
205
+ >
206
+ Add Product
207
+ </ Link >
202
208
< ProductGrid products = { products } />
203
209
</ div >
204
210
{ /* Product grid end */ }
@@ -399,42 +405,58 @@ function ProductGrid({ products }) {
399
405
< div className = "mx-auto max-w-2xl px-4 py-0 sm:px-6 sm:py-0 lg:max-w-7xl lg:px-8" >
400
406
< div className = "mt-6 grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 xl:gap-x-8" >
401
407
{ products . map ( ( product ) => (
402
- < Link to = { `/product-detail/${ product . id } ` } >
403
- < div key = { product . id } className = "group relative p-2 border-2" >
404
- < div className = "min-h-60 aspect-h-1 aspect-w-1 w-full overflow-hidden rounded-md bg-gray-200 lg:aspect-none group-hover:opacity-75 lg:h-60" >
405
- < img
406
- src = { product . thumbnail }
407
- alt = { product . title }
408
- className = "h-full w-full object-cover object-center lg:h-full lg:w-full"
409
- />
410
- </ div >
411
- < div className = "mt-4 flex justify-between" >
412
- < div >
413
- < h3 className = "text-sm text-gray-700" >
414
- < div href = { product . thumbnail } >
415
- < span aria-hidden = "true" className = "absolute inset-0" />
416
- { product . title }
408
+ < div >
409
+ < Link to = { `/product-detail/${ product . id } ` } >
410
+ < div >
411
+ < div
412
+ key = { product . id }
413
+ className = "group relative p-2 border-2"
414
+ >
415
+ < div className = "min-h-60 aspect-h-1 aspect-w-1 w-full overflow-hidden rounded-md bg-gray-200 lg:aspect-none group-hover:opacity-75 lg:h-60" >
416
+ < img
417
+ src = { product . thumbnail }
418
+ alt = { product . title }
419
+ className = "h-full w-full object-cover object-center lg:h-full lg:w-full"
420
+ />
421
+ </ div >
422
+ < div className = "mt-4 flex justify-between" >
423
+ < div >
424
+ < h3 className = "text-sm text-gray-700" >
425
+ < div href = { product . thumbnail } >
426
+ < span
427
+ aria-hidden = "true"
428
+ className = "absolute inset-0"
429
+ />
430
+ { product . title }
431
+ </ div >
432
+ </ h3 >
433
+ < p className = "mt-1 text-sm text-gray-500" >
434
+ < StarIcon className = "w-6 h-6 inline" > </ StarIcon >
435
+ < span className = "align-bottom" > { product . rating } </ span >
436
+ </ p >
417
437
</ div >
418
- </ h3 >
419
- < p className = "mt-1 text-sm text-gray-500" >
420
- < StarIcon className = "w-6 h-6 inline" > </ StarIcon >
421
- < span className = "align-bottom" > { product . rating } </ span >
422
- </ p >
423
- </ div >
424
- < div >
425
- < p className = "text-sm font-medium text-gray-900" >
426
- $
427
- { Math . round (
428
- product . price * ( 1 - product . discountPercentage / 100 )
429
- ) }
430
- < p className = "text-sm line-through font-medium text-gray-400" >
431
- ${ product . price }
432
- </ p >
433
- </ p >
438
+ < div >
439
+ < p className = "text-sm font-medium text-gray-900" >
440
+ $
441
+ { Math . round (
442
+ product . price *
443
+ ( 1 - product . discountPercentage / 100 )
444
+ ) }
445
+ < p className = "text-sm line-through font-medium text-gray-400" >
446
+ ${ product . price }
447
+ </ p >
448
+ </ p >
449
+ </ div >
450
+ </ div >
434
451
</ div >
435
452
</ div >
453
+ </ Link >
454
+ < div >
455
+ < button className = "rounded-md my-2 bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" >
456
+ Edit Product
457
+ </ button >
436
458
</ div >
437
- </ Link >
459
+ </ div >
438
460
) ) }
439
461
</ div >
440
462
</ div >
0 commit comments