Add optional URL to Product type and update Link component
Updated the `Product` type in `product-service.ts` to include an optional `url` property. Modified the `Link` component in `product-item.tsx` to use this new `url` for navigation, defaulting to '/404' if not provided. This enhances product item display by making product names clickable.
This commit is contained in:
parent
786c9e13f0
commit
ada2e1cb72
@ -7,6 +7,7 @@ export type Product = {
|
|||||||
coverUrl?: string;
|
coverUrl?: string;
|
||||||
colors?: string[];
|
colors?: string[];
|
||||||
priceSale?: number;
|
priceSale?: number;
|
||||||
|
url?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export function ProductItem({ product }: { product: Product }) {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Stack spacing={2} sx={{ p: 3 }}>
|
<Stack spacing={2} sx={{ p: 3 }}>
|
||||||
<Link color="inherit" underline="hover" variant="subtitle2" noWrap>
|
<Link color="inherit" underline="hover" variant="subtitle2" noWrap target="_blank" href={product.url ?? '/404'}>
|
||||||
{product.name}
|
{product.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user