From c26c1da4ed6908b0d6a5152899956e5984d4f95c Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Sat, 9 Dec 2023 23:48:53 +0100 Subject: [PATCH] :sparkles: added la biblioteca --- src/data/biblioteca.json | 106 +++++++++++++++++++++++++++++++++++++ src/pages/logs/books.astro | 46 ++++++++++++++++ src/pages/logs/index.md | 6 ++- src/styles/global.css | 15 ++++++ 4 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/data/biblioteca.json create mode 100644 src/pages/logs/books.astro diff --git a/src/data/biblioteca.json b/src/data/biblioteca.json new file mode 100644 index 0000000..04ce9b1 --- /dev/null +++ b/src/data/biblioteca.json @@ -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" + } +] \ No newline at end of file diff --git a/src/pages/logs/books.astro b/src/pages/logs/books.astro new file mode 100644 index 0000000..daf61cf --- /dev/null +++ b/src/pages/logs/books.astro @@ -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; +} +--- + +
+

📚 ¿Dónde está la biblioteca?

+

2023 - Currently Reading:

+

📖 Barack Obama: A Promised Land

+ {sortedYears.map(year => ( +
+
{year} - Finished
+
    + { + books.map((book) => ( +
    +

    {book.title} - {book.author}

    +

    {getEmojiStars(book.my_rating)}

    +
    + )) + } +
+
+ )) + } +
+
\ No newline at end of file diff --git a/src/pages/logs/index.md b/src/pages/logs/index.md index 12cb064..83f6635 100644 --- a/src/pages/logs/index.md +++ b/src/pages/logs/index.md @@ -5,6 +5,10 @@ layout: "../../layouts/Layout.astro" --- All my logs where I keep track of movies/TV-shows I’ve watched and books I’ve read. +I don’t use any third-party services for my logs, I store everything in a JSON-format for this website. +[***📚 Book log***](/logs/books) -I don’t use any third-party services for my logs, I store everything in a JSON-format for this website. \ No newline at end of file +[***📺 Movie log***](/logs/movies) + +[***📺 Serie log***](/logs/series) \ No newline at end of file diff --git a/src/styles/global.css b/src/styles/global.css index a3d6f75..35727b7 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -25,6 +25,10 @@ body { font-family: Verdana, sans-serif; } +p { + font-size: large; +} + /* HOME */ .social a { color: var(--light-1); @@ -94,6 +98,17 @@ body { .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 */ code { display: block;