cover: tweak styles:

- `optimizeQuality` > `smooth` (CSS language evolution)
- Use `auto` instead of a fixed width.
- Add exceptions for heights and apply them to some previously modified templates.
- Remove `is-large` exception.
- Widen the content column on list curation.
This commit is contained in:
Fabien Basmaison 2021-04-25 15:37:46 +02:00
parent 23985e4357
commit 953dff90bb
14 changed files with 55 additions and 69 deletions

View file

@ -98,7 +98,7 @@ body {
* *
* \e9d9: filled star * \e9d9: filled star
* \e9d7: empty star; * \e9d7: empty star;
******************************************************************************/ * -------------------------------------------------------------------------- */
.form-rate-stars { .form-rate-stars {
width: max-content; width: max-content;
@ -125,76 +125,45 @@ body {
/** Book covers /** Book covers
* *
* The book cover takes the full width of its ancestors layout. * - take the full width of their ancestors layout.
* - take whatever height they need.
*
* When assigning a height, add the `has-height` class.
******************************************************************************/ ******************************************************************************/
.cover-container { .cover-container {
position: relative; position: relative;
overflow: hidden;
} }
.cover-container.is-small { /* Book cover
height: 100px; -------------------------------------------------------------------------- */
}
.cover-container.is-medium {
height: 150px;
}
/*
.cover-container.is-large {
height: max-content;
max-width: 330px;
}
.cover-container.is-large img {
max-height: 500px;
height: auto;
}
@media only screen and (max-width: 768px) {
.cover-container {
height: 200px;
width: max-content;
}
.cover-container.is-medium {
height: 100px;
}
}
*/
.book-cover { .book-cover {
display: block; display: block;
width: 100%; width: auto;
/* Useful when stretching under-sized images. */ /* Useful when stretching under-sized images. */
image-rendering: optimizeQuality; image-rendering: optimizeQuality;
image-rendering: smooth;
} }
/* `height: inherit` makes sure the height computed is not approximative,
without specifying a fixed height. */
[class~="has-height"] .book-cover { [class~="has-height"] .book-cover {
width: auto; height: inherit;
height: 100%; max-height: 100%;
} }
/* Cover caption
-------------------------------------------------------------------------- */
.no-cover .cover_caption { .no-cover .cover_caption {
position: absolute; position: absolute;
padding: 1em; padding: .25em;
color: white; color: white;
top: 0; top: 0;
left: 0; left: 0;
font-size: 0.75em;
} }
/*
.cover-container.is-medium .no-cover div {
font-size: 0.9em;
padding: 0.3em;
}
.cover-container.is-small .no-cover div {
font-size: 0.7em;
padding: 0.1em;
}
*/
/** Avatars /** Avatars
******************************************************************************/ ******************************************************************************/
@ -267,3 +236,24 @@ body {
opacity: 0.5; opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }
/* Dimensions
******************************************************************************/
.is-h-small {
height: 100px !important;
}
.is-h-medium {
height: 150px !important;
}
@media only screen and (max-width: 768px) {
.is-h-small-mobile {
height: 100px !important;
}
.is-h-medium-mobile {
height: 150px;
}
}

View file

@ -48,10 +48,9 @@
<div class="columns"> <div class="columns">
<div class="column is-one-fifth"> <div class="column is-one-fifth">
<div class="is-clipped"> {% include 'snippets/book_cover.html' with book=book cover_class='has-height is-h-medium-mobile' %}
{% include 'snippets/book_cover.html' with book=book cover_class='is-large' %}
{% include 'snippets/rate_action.html' with user=request.user book=book %} {% include 'snippets/rate_action.html' with user=request.user book=book %}
</div>
<div class="mb-3"> <div class="mb-3">
{% include 'snippets/shelve_button/shelve_button.html' %} {% include 'snippets/shelve_button/shelve_button.html' %}
</div> </div>

View file

@ -170,7 +170,7 @@
<h2 class="title is-4">{% trans "Cover" %}</h2> <h2 class="title is-4">{% trans "Cover" %}</h2>
<div class="columns"> <div class="columns">
<div class="column is-narrow"> <div class="column is-narrow">
{% include 'snippets/book_cover.html' with book=book cover_class='is-small' %} {% include 'snippets/book_cover.html' with book=book cover_class='is-h-small' %}
</div> </div>
<div class="column is-narrow"> <div class="column is-narrow">
<div class="block"> <div class="block">

View file

@ -16,7 +16,7 @@
<div class="columns"> <div class="columns">
<div class="column is-2"> <div class="column is-2">
<a href="/book/{{ book.id }}"> <a href="/book/{{ book.id }}">
{% include 'snippets/book_cover.html' with book=book cover_class='is-medium' %} {% include 'snippets/book_cover.html' with book=book cover_class='is-h-medium' %}
</a> </a>
</div> </div>
<div class="column is-7"> <div class="column is-7">

View file

@ -8,7 +8,7 @@
<div class="column"> <div class="column">
<a <a
href="{{ book.local_path }}" href="{{ book.local_path }}"
>{% include 'snippets/book_cover.html' with cover_class='is-large' %}</a> >{% include 'snippets/book_cover.html' %}</a>
{% include 'snippets/stars.html' with rating=book|rating:request.user %} {% include 'snippets/stars.html' with rating=book|rating:request.user %}
</div> </div>

View file

@ -6,7 +6,7 @@
{% with book=book %} {% with book=book %}
<a <a
href="{{ book.local_path }}" href="{{ book.local_path }}"
>{% include 'snippets/book_cover.html' with cover_class='is-small' %}</a> >{% include 'snippets/book_cover.html' with cover_class='is-h-small' %}</a>
{% include 'snippets/stars.html' with rating=book|rating:request.user %} {% include 'snippets/stars.html' with rating=book|rating:request.user %}

View file

@ -37,7 +37,7 @@
aria-label="{{ book.title }}" aria-label="{{ book.title }}"
aria-selected="{% if active_book == book.id|stringformat:'d' %}true{% elif shelf_counter == 1 and forloop.first %}true{% else %}false{% endif %}" aria-selected="{% if active_book == book.id|stringformat:'d' %}true{% elif shelf_counter == 1 and forloop.first %}true{% else %}false{% endif %}"
aria-controls="book-{{ book.id }}"> aria-controls="book-{{ book.id }}">
{% include 'snippets/book_cover.html' with book=book cover_class='is-medium' %} {% include 'snippets/book_cover.html' with book=book cover_class='is-h-medium' %}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}

View file

@ -125,7 +125,7 @@
<td> <td>
{% if item.book %} {% if item.book %}
<a href="/book/{{ item.book.id }}"> <a href="/book/{{ item.book.id }}">
{% include 'snippets/book_cover.html' with book=item.book cover_class='is-small' %} {% include 'snippets/book_cover.html' with book=item.book cover_class='is-h-small' %}
</a> </a>
{% endif %} {% endif %}
</td> </td>

View file

@ -32,10 +32,10 @@
href="{{ book.local_path }}" href="{{ book.local_path }}"
aria-hidden="true" aria-hidden="true"
> >
{% include 'snippets/book_cover.html' with cover_class='is-small' %} {% include 'snippets/book_cover.html' %}
</a> </a>
<div class="column is-9-mobile is-10-tablet ml-3"> <div class="column is-10-mobile is-10-tablet ml-3">
{% include 'snippets/book_titleby.html' %} {% include 'snippets/book_titleby.html' %}
</div> </div>
</div> </div>

View file

@ -11,10 +11,10 @@
{% with list_books=list.listitem_set.all|slice:5 %} {% with list_books=list.listitem_set.all|slice:5 %}
{% if list_books %} {% if list_books %}
<div class="card-image columns is-mobile is-gapless is-clipped has-height"> <div class="card-image columns is-mobile is-gapless is-clipped">
{% for book in list_books %} {% for book in list_books %}
<a class="column is-narrow" href="{{ book.book.local_path }}"> <a class="column is-narrow" href="{{ book.book.local_path }}">
{% include 'snippets/book_cover.html' with book=book.book cover_class='is-small' aria='show' %} {% include 'snippets/book_cover.html' with book=book.book cover_class='has-height is-h-small' aria='show' %}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View file

@ -6,9 +6,6 @@
<figure <figure
class=" class="
cover-container cover-container
is-clipped
is-flex
is-align-items-center
{{ cover_class }} {{ cover_class }}
{% if not book.cover %} {% if not book.cover %}

View file

@ -8,7 +8,7 @@
<div class="columns is-mobile"> <div class="columns is-mobile">
<div class="column is-narrow"> <div class="column is-narrow">
<div> <div>
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book cover_class='is-small' %}</a> <a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book cover_class='is-h-small' %}</a>
</div> </div>
</div> </div>
<div class="column"> <div class="column">

View file

@ -86,7 +86,7 @@
{% for book in books %} {% for book in books %}
<tr class="book-preview"> <tr class="book-preview">
<td> <td>
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book cover_class='is-small' %}</a> <a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book cover_class='is-h-small' %}</a>
</td> </td>
<td> <td>
<a href="{{ book.local_path }}">{{ book.title }}</a> <a href="{{ book.local_path }}">{{ book.title }}</a>

View file

@ -36,7 +36,7 @@
{% for book in shelf.books %} {% for book in shelf.books %}
<div class="control"> <div class="control">
<a href="{{ book.local_path }}"> <a href="{{ book.local_path }}">
{% include 'snippets/book_cover.html' with book=book cover_class='is-medium' %} {% include 'snippets/book_cover.html' with book=book cover_class='is-h-medium' %}
</a> </a>
</div> </div>
{% endfor %} {% endfor %}