feat: book progress bars

This commit is contained in:
Cory Dransfeldt 2024-06-02 12:55:59 -07:00
parent cc2ca7d134
commit d31ce9b2cd
No known key found for this signature in database
6 changed files with 24 additions and 5 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "18.2.4", "version": "18.3.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "coryd.dev", "name": "coryd.dev",
"version": "18.2.4", "version": "18.3.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@cdransf/api-text": "^1.4.0", "@cdransf/api-text": "^1.4.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "18.2.4", "version": "18.3.4",
"description": "The source for my personal site. Built using 11ty.", "description": "The source for my personal site. Built using 11ty.",
"type": "module", "type": "module",
"scripts": { "scripts": {

View file

@ -67,7 +67,8 @@ export default async function () {
image: book['thumbnail'], image: book['thumbnail'],
url: `/books/${book['isbn']}`, url: `/books/${book['isbn']}`,
date, date,
status: book['status'], status: book['read_status'],
progress: book['progress'],
tags: book['tags'], tags: book['tags'],
rating: book['rating'] !== 'unrated' ? book['rating'] : '', rating: book['rating'] !== 'unrated' ? book['rating'] : '',
isbn: book['isbn'], isbn: book['isbn'],

View file

@ -37,6 +37,10 @@
width: fit-content; width: fit-content;
} }
& .progress-bar-wrapper {
max-width: 75%;
}
& blockquote.description { & blockquote.description {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
display: -webkit-box; display: -webkit-box;
@ -102,6 +106,10 @@
& .book-meta { & .book-meta {
align-items: start; align-items: start;
& .progress-bar-wrapper {
max-width: 40%;
}
} }
} }
} }

View file

@ -38,7 +38,13 @@ schema: book
{% if book.author %} {% if book.author %}
<p class="sub-meta">By {{ book.author }}</p> <p class="sub-meta">By {{ book.author }}</p>
{% endif %} {% endif %}
{% if book.status == 'finished' %}<p class="sub-meta">Finished on: {{ book.date | date: "%B %e, %Y" }}</p>{% endif %} {% if book.status == 'finished' %}
<p class="sub-meta">Finished on: {{ book.date | date: "%B %e, %Y" }}</p>
{% endif %}
{% unless book.status == 'finished' %}
{%- assign percentage = book.progress | append: '%' -%}
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
{% endunless %}
<p class="sub-meta"><a href="https://openlibrary.org/isbn/{{ book.isbn }}" title="View {{ book.title | escape }} on Open Library">View on Open Library</a></p> <p class="sub-meta"><a href="https://openlibrary.org/isbn/{{ book.isbn }}" title="View {{ book.title | escape }} on Open Library">View on Open Library</a></p>
</div> </div>
</div> </div>

View file

@ -44,6 +44,10 @@ schema: books
{% if book.author %} {% if book.author %}
<p class="sub-meta">By {{ book.author }}</p> <p class="sub-meta">By {{ book.author }}</p>
{% endif %} {% endif %}
{% if book.progress %}
{%- assign percentage = book.progress | append: '%' -%}
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
{% endif %}
{% if book.description %}<blockquote class="description">{{ book.description }}</blockquote>{% endif %} {% if book.description %}<blockquote class="description">{{ book.description }}</blockquote>{% endif %}
</div> </div>
</article> </article>