Adds css transitions to notification and unread statuses

This commit is contained in:
Mouse Reeve 2021-03-23 17:52:58 -07:00
parent 701487c526
commit 8d5630e059
3 changed files with 25 additions and 2 deletions

View file

@ -34,6 +34,29 @@ html {
.hidden { .hidden {
display: none !important; display: none !important;
} }
.hidden.transition-y, .hidden.transition-x {
display: block !important;
visibility: hidden !important;
height: 0;
width: 0;
margin: 0;
padding: 0;
}
.transition-y {
transition-property: height, margin-top, margin-bottom, padding-top, padding-bottom;
transition-duration: 0.5s;
transition-timing-function: ease;
}
.transition-x {
transition-property: width, margin-left, margin-right, padding-left, padding-right;
transition-duration: 0.5s;
transition-timing-function: ease;
}
@media (prefers-reduced-motion: reduce) {
.transition-x, .transition-y {
transition-duration: 0.001ms !important;
}
}
/* --- STARS --- */ /* --- STARS --- */
.rate-stars button.icon { .rate-stars button.icon {

View file

@ -28,7 +28,7 @@
{# announcements and system messages #} {# announcements and system messages #}
{% if not activities.number > 1 %} {% if not activities.number > 1 %}
<a href="{{ request.path }}" class="hidden notification is-primary is-block" data-poll-wrapper> <a href="{{ request.path }}" class="transition-y hidden notification is-primary is-block" data-poll-wrapper>
{% blocktrans %}load <span data-poll="stream/{{ tab }}">0</span> unread status(es){% endblocktrans %} {% blocktrans %}load <span data-poll="stream/{{ tab }}">0</span> unread status(es){% endblocktrans %}
</a> </a>

View file

@ -139,7 +139,7 @@
<span class="is-sr-only">{% trans "Notifications" %}</span> <span class="is-sr-only">{% trans "Notifications" %}</span>
</span> </span>
</span> </span>
<span class="{% if not request.user|notification_count %}hidden {% endif %}tag is-danger is-medium" data-poll-wrapper> <span class="{% if not request.user|notification_count %}hidden {% endif %}tag is-danger is-medium transition-x" data-poll-wrapper>
<span data-poll="notifications">{{ request.user | notification_count }}</span> <span data-poll="notifications">{{ request.user | notification_count }}</span>
</span> </span>
</a> </a>