Make navbar dropdown

rust
Elnu 1 year ago
parent 1f33a60f7a
commit 381c2b282d

@ -42,7 +42,25 @@ body {
display: flex; display: flex;
& > * { .dropdown {
position: relative;
display: flex;
padding: 0;
.dropdown-content {
flex-direction: column;
position: absolute;
top: 100%;
left: 0;
width: 100%;
}
&:not(:hover) .dropdown-content {
display: none !important;
}
}
& > *, .dropdown > a {
padding: 0.45em; padding: 0.45em;
& > * { & > * {
@ -50,17 +68,9 @@ body {
} }
} }
& > a { a {
color: var(--fg); color: var(--fg);
font-weight: bold; font-weight: bold;
&:hover {
border: none;
--fg: #{$fg};
--bg: #{$bg};
background: var(--bg);
cursor: pointer;
}
} }
& > .right { & > .right {
@ -74,6 +84,14 @@ body {
} }
} }
.dropdown:hover > a, nav > a:hover {
border: none;
--fg: #{$fg};
--bg: #{$bg};
background: var(--bg);
cursor: pointer;
}
.svg-inline { .svg-inline {
height: 1em; height: 1em;
vertical-align: -0.125em; vertical-align: -0.125em;

@ -19,12 +19,17 @@
</div> </div>
{% endif %} {% endif %}
{% if user %} {% if user %}
<a href="#" class="right"> <div class="dropdown right">
<span>{{ user.username }}</span> <img src="https://cdn.discordapp.com/avatars/{{ user.id }}/{{ user.avatar }}.webp?size=1024"> <a href="/users/{{ user.id }}">
</a> <span>{{ user.username }}</span> <img src="https://cdn.discordapp.com/avatars/{{ user.id }}/{{ user.avatar }}.webp?size=1024">
<a href="/logout"> </a>
<span>Log out</span> <nav class="dropdown-content">
</a> <a href="/logout">
<span>Log out</span>
</a>
</nav>
</div>
{% else%} {% else%}
<a href="/login" class="right">Log in</a> <a href="/login" class="right">Log in</a>
{% endif %} {% endif %}

Loading…
Cancel
Save