added la biblioteca

This commit is contained in:
Sindre Kjelsrud 2023-12-09 23:48:53 +01:00
parent bfdc04e02f
commit c26c1da4ed
4 changed files with 172 additions and 1 deletions

106
src/data/biblioteca.json Normal file
View file

@ -0,0 +1,106 @@
[
{
"isbn": "9781506727608",
"title": "Mob Psycho 100: Vol. 8",
"date":
{
"year": "2023",
"month": "11",
"day": "30",
"string": "2023-11-30"
},
"my_rating": 4,
"author": "ONE"
},
{
"isbn": "9780140455526",
"title": "The Art of War",
"date":
{
"year": "2023",
"month": "07",
"day": "12",
"string": "2023-07-12"
},
"my_rating": 4,
"author": "Sun-tzu"
},
{
"isbn": "9781506727592",
"title": "Mob Psycho 100: Vol. 7",
"date":
{
"year": "2023",
"month": "06",
"day": "16",
"string": "2023-06-16"
},
"my_rating": 3,
"author": "ONE"
},
{
"isbn": "9781529392401",
"title": "Will Artificial Intelligence Outsmart Us?",
"date":
{
"year": "2023",
"month": "06",
"day": "13",
"string": "2023-06-13"
},
"my_rating": 3,
"author": "Stephen Hawking"
},
{
"isbn": "9788269259346",
"title": "Magnus",
"date":
{
"year": "2023",
"month": "06",
"day": "01",
"string": "2023-06-01"
},
"my_rating": 5,
"author": "Magnus Midtbø, Thor Gotaas"
},
{
"isbn": "9788234713538",
"title": "Hjertet i to: Seks måneder med Karpe",
"date":
{
"year": "2023",
"month": "05",
"day": "28",
"string": "2023-05-28"
},
"my_rating": 5,
"author": "Yohan Shanmugaratnam"
},
{
"isbn": "9781421578798",
"title": "JoJo's Bizarre Adventure: Phantom Blood Vol. 1",
"date":
{
"year": "2023",
"month": "05",
"day": "22",
"string": "2023-05-22"
},
"my_rating": 3,
"author": "Araki, Hirohiko"
},
{
"isbn": "9788202410445",
"title": "Steve Jobs",
"date":
{
"year": "2023",
"month": "05",
"day": "15",
"string": "2023-05-15"
},
"my_rating": 4,
"author": "Walter Isaacson"
}
]

View file

@ -0,0 +1,46 @@
---
import SectionContainer from '../../components/SectionContainer.astro';
import books from '../../data/biblioteca.json'
const postsByYear = books.reduce((acc, book) => {
const year = new Date(book.date.string).getFullYear();
if (!acc[year]) {
acc[year] = [];
}
acc[year].push(book);
return acc;
}, {});
const sortedYears = Object.keys(postsByYear).sort((a, b) => b - a);
function getEmojiStars(rating) {
let stars = '';
for (let i = 0; i < rating; i++) {
stars += '⭐';
}
return stars;
}
---
<SectionContainer>
<main class="flex flex-col h-screen gap-4 mt-4">
<h1 class="text-3xl font-extrabold">📚 ¿Dónde está la biblioteca?</h1>
<h2 class="text-xl font-semibold">2023 - Currently Reading:</h2>
<p>📖 Barack Obama: A Promised Land</p>
{sortedYears.map(year => (
<section>
<div class="text-xl font-semibold mb-2">{year} - Finished</div>
<ul>
{
books.map((book) => (
<div class="flex justify-between mb-2 break-words gap-2 borderbottom">
<p class="text-s">{book.title} - {book.author}</p>
<p>{getEmojiStars(book.my_rating)}</p>
</div>
))
}
</ul>
</section>
))
}
</main>
</SectionContainer>

View file

@ -5,6 +5,10 @@ layout: "../../layouts/Layout.astro"
--- ---
All my logs where I keep track of movies/TV-shows Ive watched and books Ive read. All my logs where I keep track of movies/TV-shows Ive watched and books Ive read.
I dont use any third-party services for my logs, I store everything in a JSON-format for this website.
[***📚 Book log***](/logs/books)
I dont use any third-party services for my logs, I store everything in a JSON-format for this website. [***📺 Movie log***](/logs/movies)
[***📺 Serie log***](/logs/series)

View file

@ -25,6 +25,10 @@ body {
font-family: Verdana, sans-serif; font-family: Verdana, sans-serif;
} }
p {
font-size: large;
}
/* HOME */ /* HOME */
.social a { .social a {
color: var(--light-1); color: var(--light-1);
@ -94,6 +98,17 @@ body {
.dark .blogtime { color: var(--dark-2); } .dark .blogtime { color: var(--dark-2); }
/* LOGS */
.borderbottom {
border-bottom-width: 2px;
border-color: var(--light-3);
}
.dark .borderbottom {
border-bottom-width: 2px;
border-color: var(--dark-3);
}
/* RANDOM */ /* RANDOM */
code { code {
display: block; display: block;