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:
tekh 2025-07-03 09:14:49 +02:00
parent 786c9e13f0
commit ada2e1cb72
2 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ export type Product = {
coverUrl?: string;
colors?: string[];
priceSale?: number;
url?: string;
};
/**

View File

@ -93,7 +93,7 @@ export function ProductItem({ product }: { product: Product }) {
</Box>
<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}
</Link>