File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
app/[locale]/(main)/(container)/cart Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import CartItemController from '@/components/CartItemController/CartItemControll
55import { getFragmentData } from '@/graphql/types' ;
66import {
77 CartItemContentFragmentDoc ,
8+ ProductContentSliceFragmentDoc ,
89 ProductVariationContentSliceFragmentDoc ,
910 StockStatusEnum ,
1011} from '@/graphql/types/graphql' ;
@@ -153,13 +154,22 @@ const Page = () => {
153154 ProductVariationContentSliceFragmentDoc ,
154155 _item . variation ?. node ,
155156 ) ! ;
157+
158+ const product = getFragmentData (
159+ ProductContentSliceFragmentDoc ,
160+ _item . product ?. node ,
161+ ) ;
162+
156163 const isOutOfStock =
157164 variant . stockStatus === StockStatusEnum . OutOfStock ;
158165
159166 return (
160167 < Grid item xs = { 12 } key = { _item ?. key } >
161168 < Stack spacing = { 2 } >
162- < CartItem value = { variant } />
169+ < CartItem
170+ value = { variant }
171+ href = { `/products/${ product ?. databaseId } ` }
172+ />
163173 < Stack direction = "row" spacing = { 1 } >
164174 < Box width = { 200 } >
165175 < CartItemController
Original file line number Diff line number Diff line change 1- import { Box , Stack , Typography } from '@mui/material' ;
1+ import { Box , Link , Stack , Typography } from '@mui/material' ;
22import React , { FC } from 'react' ;
33import Attributes from './components/Attributes' ;
44import Image from '../common/Image' ;
55import { ProductVariationContentSliceFragment } from '@/graphql/types/graphql' ;
66
77export interface CartItemProps {
88 value : ProductVariationContentSliceFragment ;
9+ href ?: string ;
910}
10- const CartItem : FC < CartItemProps > = ( { value } ) => {
11+ const CartItem : FC < CartItemProps > = ( { value, href = '#' } ) => {
1112 return (
1213 < Stack gap = { 2 } direction = "row" >
13- < Image width = { 80 } height = { 80 } src = { value ?. image ?. sourceUrl } alt = "Image" />
14+ < Link href = { href } >
15+ < Image
16+ width = { 80 }
17+ height = { 80 }
18+ src = { value ?. image ?. sourceUrl }
19+ alt = "Image"
20+ />
21+ </ Link >
1422 < Box flexGrow = { 1 } >
1523 < Stack gap = { 2 } >
16- < Typography variant = "body1" sx = { { fontWeight : 600 } } >
17- { value ?. name }
18- </ Typography >
24+ < Link href = { href } >
25+ < Typography variant = "body1" sx = { { fontWeight : 600 } } >
26+ { value ?. name }
27+ </ Typography >
28+ </ Link >
29+
1930 < Attributes
2031 size = { value ?. attributes ?. nodes ?. [ 0 ] ?. value ?. toUpperCase ( ) }
2132 />
You can’t perform that action at this time.
0 commit comments