-
Notifications
You must be signed in to change notification settings - Fork 2
/
intro-card.astro
61 lines (58 loc) · 1013 Bytes
/
intro-card.astro
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
---
import { Image } from 'astro:assets';
interface Props {
image: ImageMetadata
imageAlt: string
};
const { image, imageAlt } = Astro.props;
---
<div class="card">
<Image
src={image}
alt={imageAlt}
width={400}
/>
<div class="intro-content">
<slot />
</div>
</div>
<style>
img {
width: 200px;
height: auto;
aspect-ratio: 1 / 1;
border-radius: 1em;
object-fit: cover;
object-position: bottom;
}
.card {
display: flex;
align-items: center;
padding: 20px;
border-radius: 10px;
background-color: hsl(var(--blue-base) 95%);
gap: 2rem;
padding: 2em;
}
.card:nth-child(odd) {
flex-direction: row;
}
.card:nth-child(even) {
flex-direction: row-reverse;
}
.intro-content {
display: flex;
flex-direction: column;
}
@media (max-width: 768px) {
.card:nth-child(odd) {
flex-direction: column;
}
.card:nth-child(even) {
flex-direction: column;
}
img {
width: 200px;
}
}
</style>