Skip to content

Commit 290292b

Browse files
committed
feat: add impressions section
1 parent 256e50b commit 290292b

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
---
22
import { currentLocale } from "astro-nanostores-i18n:runtime";
33
import Image from "astro/components/Image.astro";
4-
import { getCollection } from "astro:content";
54
import { getEntry } from "astro:content";
65
76
type Props = {
87
class?: string;
9-
title: string;
8+
gallery: string;
109
};
1110
12-
const { class: className, title } = Astro.props;
11+
const { class: className, gallery } = Astro.props;
1312
const locale = currentLocale.get();
14-
console.log(className);
15-
console.log(await getCollection("galleries"));
16-
const gallery = await getEntry("galleries", `${title}/${locale}`);
17-
if (!gallery) {
18-
throw new Error(`Gallery not found: ${title} (${locale})`);
13+
const galleryEntry = await getEntry("galleries", `${gallery}/${locale}`);
14+
if (!galleryEntry) {
15+
throw new Error(`Gallery not found: ${gallery} (${locale})`);
1916
}
2017
---
2118

2219
<section class:list={[className]}>
2320
<slot name="title" />
2421
<div>
2522
{
26-
gallery.data.items.map((item) => (
27-
<div>
28-
<Image src={item.photo} alt={typeof item.label === "string" ? item.label : ""} />
29-
</div>
23+
galleryEntry.data.items.map((item) => (
24+
<Image src={item.photo} width={800} alt={typeof item.label === "string" ? item.label : ""} />
3025
))
3126
}
3227
</div>
3328
</section>
29+
30+
<style>
31+
section {
32+
& > div {
33+
display: grid;
34+
grid-template-columns: repeat(2, 1fr);
35+
justify-items: center;
36+
37+
img {
38+
height: auto;
39+
width: 100%;
40+
object-fit: cover;
41+
border-radius: var(--size-border-radius);
42+
filter: saturate(0.2);
43+
transition: 1s;
44+
45+
&:hover {
46+
filter: saturate(1);
47+
}
48+
}
49+
}
50+
}
51+
</style>

0 commit comments

Comments
 (0)