-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathCartItem.tsx
40 lines (36 loc) · 987 Bytes
/
CartItem.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
import Link from 'next/link';
import { Product } from '../../protos/demo';
import ProductPrice from '../ProductPrice';
import * as S from './CartItems.styled';
interface IProps {
product: Product;
quantity: number;
}
const CartItem = ({
product: { id, name, picture, priceUsd = { units: 0, nanos: 0, currencyCode: 'USD' } },
quantity,
}: IProps) => {
return (
<S.CartItem>
<Link href={`/product/${id}`}>
<S.NameContainer>
<S.CartItemImage alt={name} src={"/images/products/" + picture} />
<p>{name}</p>
</S.NameContainer>
</Link>
<S.CartItemDetails>
<p>{quantity}</p>
</S.CartItemDetails>
<S.CartItemDetails>
<S.PriceContainer>
<p>
<ProductPrice price={priceUsd} />
</p>
</S.PriceContainer>
</S.CartItemDetails>
</S.CartItem>
);
};
export default CartItem;