-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathProductDisplay.tsx
More file actions
42 lines (36 loc) · 966 Bytes
/
ProductDisplay.tsx
File metadata and controls
42 lines (36 loc) · 966 Bytes
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
41
42
import React from "react";
interface Product {
name: string;
icon: string;
price: number;
imageSrc: string;
imageAlt: string;
}
interface ProductDisplayProps {
product: Product;
}
const ProductDisplay: React.FC<ProductDisplayProps> = ({ product }) => {
return (
<>
<div className="product-header">
<h1 className="product-title">
{product.icon} {product.name}
</h1>
<h3 className="product-price">Price: ${product.price.toFixed(2)}</h3>
</div>
<div className="product-image-container">
<img
src={product.imageSrc}
alt={product.imageAlt}
className="product-image"
data-testid="product-image"
/>
</div>
<div className="checkout-summary">
<p>Estimated Total: ${product.price.toFixed(2)}</p>
<p>Taxes, discounts and shipping calculated at checkout</p>
</div>
</>
);
};
export default ProductDisplay;