blob: 14e6e1d8ca60aed2a10ee667afc35d3f79d1c145 (
plain) (
blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
import type { Product } from '../api';
interface Props {
products: Product[];
}
const { products } = Astro.props;
---
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
figure {
width: 200px;
padding: 7px;
border: 1px solid black;
display: flex;
flex-direction: column;
}
figure figcaption {
text-align: center;
line-height: 1.6;
}
figure img {
width: 100%;
height: 250px;
object-fit: cover;
}
.product a {
display: block;
text-decoration: none;
color: inherit;
}
.name {
font-weight: 500;
}
.price {
font-size: 90%;
color: #787878;
}
</style>
<slot name="title" />
<ul>
{
products.map((product) => (
<li class="product">
<a href={`/products/${product.id}`}>
<figure>
<img src={product.image} />
<figcaption>
<div class="name">{product.name}</div>
<div class="price">${product.price}</div>
</figcaption>
</figure>
</a>
</li>
))
}
</ul>
|