Highlight active profile section.

This commit is contained in:
flash 2019-05-09 18:46:49 +02:00
parent 32c18c4e29
commit 0bf70f82df
3 changed files with 14 additions and 7 deletions

View file

@ -200,11 +200,6 @@
&--link { &--link {
cursor: pointer; cursor: pointer;
&:hover,
&:focus {
border-bottom: 2px solid var(--accent-colour);
}
} }
@media (max-width: @site-mobile-width) { @media (max-width: @site-mobile-width) {
@ -212,6 +207,13 @@
text-align: right; text-align: right;
} }
} }
&--link:hover,
&--link:focus,
&--link:active,
&--active {
border-bottom: 2px solid var(--accent-colour);
}
} }
&__username { &__username {

View file

@ -88,11 +88,12 @@
{% if stat.value|default(false) %} {% if stat.value|default(false) %}
{% set is_date = stat.is_date|default(false) %} {% set is_date = stat.is_date|default(false) %}
{% set is_url = stat.url is defined %} {% set is_url = stat.url is defined %}
{% set active_class = stat.active|default(false) ? ' profile__header__stat--active' : '' %}
{% if is_url %} {% if is_url %}
<a class="profile__header__stat profile__header__stat--link" href="{{ stat.url }}"> <a class="profile__header__stat profile__header__stat--link{{ active_class }}" href="{{ stat.url }}">
{% else %} {% else %}
<div class="profile__header__stat{% if is_date %} profile__header__stat--date" title="{{ stat.value|date('r') }}{% endif %}"> <div class="profile__header__stat{{ active_class }}{% if is_date %} profile__header__stat--date" title="{{ stat.value|date('r') }}{% endif %}">
{% endif %} {% endif %}
<div class="profile__header__stat__name"> <div class="profile__header__stat__name">
{{ stat.title }} {{ stat.title }}

View file

@ -17,21 +17,25 @@
'title': 'Following', 'title': 'Following',
'value': profile.following_count, 'value': profile.following_count,
'url': url('user-profile-following', {'user': profile.user_id}), 'url': url('user-profile-following', {'user': profile.user_id}),
'active': profile_mode == 'following',
}, },
{ {
'title': 'Followers', 'title': 'Followers',
'value': profile.followers_count, 'value': profile.followers_count,
'url': url('user-profile-followers', {'user': profile.user_id}), 'url': url('user-profile-followers', {'user': profile.user_id}),
'active': profile_mode == 'followers',
}, },
{ {
'title': 'Topics', 'title': 'Topics',
'value': profile.forum_topic_count, 'value': profile.forum_topic_count,
'url': url('user-profile-forum-topics', {'user': profile.user_id}), 'url': url('user-profile-forum-topics', {'user': profile.user_id}),
'active': profile_mode == 'forum-topics',
}, },
{ {
'title': 'Posts', 'title': 'Posts',
'value': profile.forum_post_count, 'value': profile.forum_post_count,
'url': url('user-profile-forum-posts', {'user': profile.user_id}), 'url': url('user-profile-forum-posts', {'user': profile.user_id}),
'active': profile_mode == 'forum-posts',
}, },
{ {
'title': 'Comments', 'title': 'Comments',