✨ added vinyl collection page
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
2b7805a380
commit
c2d9378f9e
7 changed files with 78 additions and 3 deletions
BIN
public/img/vinyl/college_park.png
Normal file
BIN
public/img/vinyl/college_park.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
BIN
public/img/vinyl/evig_eventyr.jpg
Normal file
BIN
public/img/vinyl/evig_eventyr.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
BIN
public/img/vinyl/minecraft_volume_alpha.jpg
Normal file
BIN
public/img/vinyl/minecraft_volume_alpha.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
BIN
public/img/vinyl/sa_klart_det_gjor_vondt.jpg
Normal file
BIN
public/img/vinyl/sa_klart_det_gjor_vondt.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
22
src/data/vinyl.json
Normal file
22
src/data/vinyl.json
Normal 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"
|
||||
}
|
||||
]
|
|
@ -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
51
src/pages/vinyl.astro
Normal 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>
|
Loading…
Reference in a new issue