--- 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)}

    )) }
)) }