added vinyl collection page

Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
Sindre Kjelsrud 2023-12-13 13:47:27 +01:00
parent 2b7805a380
commit c2d9378f9e
Signed by untrusted user who does not match committer: sidski
GPG key ID: D2BBDF3EDE6BA9A6
7 changed files with 78 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

22
src/data/vinyl.json Normal file
View file

@ -0,0 +1,22 @@
[
{
"album": "Minecraft Volume Alpha",
"artist": "C418",
"cover": "/img/vinyl/minecraft_volume_alpha.jpg"
},
{
"album": "College Park",
"artist": "Logic",
"cover": "/img/vinyl/college_park.png"
},
{
"album": "Evig Eventyr",
"artist": "Ka2",
"cover": "/img/vinyl/evig_eventyr.jpg"
},
{
"album": "SÅ KLART DET GJØR VONDT",
"artist": "Ramón",
"cover": "/img/vinyl/sa_klart_det_gjor_vondt.jpg"
}
]

View file

@ -6,10 +6,12 @@ layout: "../layouts/Layout.astro"
[🌐 Connect](/connect)
[✨ Uses](/uses)
[📜 CV (under construction)](/)
[🌱 Digital garden](/garden)
[📚 Logs](/logs)
[🌱 Digital garden](/garden)
[✨ Uses](/uses)
[📀 Vinyl collection](/vinyl)

51
src/pages/vinyl.astro Normal file
View file

@ -0,0 +1,51 @@
---
import SectionContainer from '../components/SectionContainer.astro';
import vinyl from '../data/vinyl.json'
const vinylByAlbumTitle = vinyl.reduce((acc:any, currentVinyl) => {
const { album, artist, cover } = currentVinyl;
if (!acc[album]) {
acc[album] = {
vinyls: [],
artist: artist,
cover: cover
};
}
acc[album].vinyls.push(currentVinyl);
return acc;
}, {});
const vinylData = Object.keys(vinylByAlbumTitle).map(albumTitle => {
const albumData = vinylByAlbumTitle[albumTitle];
return {
title: albumTitle,
artist: albumData.artist,
cover: albumData.cover,
vinyl: albumData.vinyls,
};
});
---
<SectionContainer>
<div class="flex flex-col gap-4 mt-4">
<div>
<h1 class="font-bold text-3xl">
📀 Platesamlinga
</h1>
<p class="italic">Here's a collection of all the vinyl's that I got!</p>
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-6">
{vinylData.map((album) => (
<div class="flex flex-col">
<img
src={album.cover}
class="w-400"
/>
<p class="font-bold">{album.title}</p>
<p>{album.artist}</p>
</div>
))}
</div>
</div>
</SectionContainer>