Fix header layout for long list titles

This commit is contained in:
kolaente 2021-06-23 22:08:20 +02:00
parent f58a48bc1f
commit 543df91aba
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
6 changed files with 34 additions and 14 deletions

View file

@ -25,7 +25,7 @@
> >
<icon icon="bars"></icon> <icon icon="bars"></icon>
</a> </a>
<div class="list-title" v-if="currentList.id"> <div class="list-title" v-if="currentList.id" ref="listTitle">
<h1 <h1
:style="{ 'opacity': currentList.title === '' ? '0': '1' }" :style="{ 'opacity': currentList.title === '' ? '0': '1' }"
class="title"> class="title">
@ -48,7 +48,7 @@
<notifications/> <notifications/>
<div class="user"> <div class="user">
<img :src="userAvatar" alt="" class="avatar"/> <img :src="userAvatar" alt="" class="avatar"/>
<dropdown class="is-right"> <dropdown class="is-right" ref="usernameDropdown">
<template v-slot:trigger> <template v-slot:trigger>
<x-button <x-button
type="secondary" type="secondary"
@ -116,6 +116,10 @@ export default {
privacyPolicyUrl: state => state.config.legal.privacyPolicyUrl, privacyPolicyUrl: state => state.config.legal.privacyPolicyUrl,
canWriteCurrentList: state => state.currentList.maxRight > Rights.READ, canWriteCurrentList: state => state.currentList.maxRight > Rights.READ,
}), }),
mounted() {
const usernameWidth = this.$refs.usernameDropdown.$el.clientWidth
this.$refs.listTitle.style.setProperty('--nav-username-width', `${usernameWidth}px`)
},
methods: { methods: {
logout() { logout() {
this.$store.dispatch('auth/logout') this.$store.dispatch('auth/logout')

View file

@ -1,9 +1,11 @@
<template> <template>
<div class="notifications"> <div class="notifications">
<div class="is-flex is-justify-content-center">
<a @click.stop="showNotifications = !showNotifications" class="trigger-button"> <a @click.stop="showNotifications = !showNotifications" class="trigger-button">
<span class="unread-indicator" v-if="unreadNotifications > 0"></span> <span class="unread-indicator" v-if="unreadNotifications > 0"></span>
<icon icon="bell"/> <icon icon="bell"/>
</a> </a>
</div>
<transition name="fade"> <transition name="fade">
<div class="notifications-list" v-if="showNotifications" ref="popup"> <div class="notifications-list" v-if="showNotifications" ref="popup">

View file

@ -24,9 +24,17 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
$edit-icon-width: 1rem;
@media screen and (min-width: $tablet) {
// We need a fixed width for overflowing ellipsis to work
--nav-username-width: 0;
width: calc(100vw - #{$user-dropdown-width-mobile} - #{2 * $hamburger-menu-icon-spacing} - #{$hamburger-menu-icon-width} - #{$edit-icon-width} - #{2 * $navbar-icon-width} - #{$vikunja-nav-logo-full-width} - var(--nav-username-width));
}
@media screen and (max-width: $tablet) { @media screen and (max-width: $tablet) {
// We need a fixed width for overflowing ellipsis to work // We need a fixed width for overflowing ellipsis to work
width: calc(100vw - #{$user-dropdown-width-mobile} - #{2 * $hamburger-menu-icon-spacing} - #{$hamburger-menu-icon-width} - 1rem); // -1rem for the edit icon width: calc(100vw - #{$user-dropdown-width-mobile} - #{2 * $hamburger-menu-icon-spacing} - #{$hamburger-menu-icon-width} - #{$edit-icon-width} - #{2 * $navbar-icon-width});
} }
h1 { h1 {

View file

@ -1,5 +1,5 @@
.notifications { .notifications {
width: 50px; width: $navbar-icon-width;
.unread-indicator { .unread-indicator {
position: absolute; position: absolute;

View file

@ -1,7 +1,7 @@
@use "sass:math"; @use "sass:math";
.navbar { .navbar {
z-index: 2; z-index: 4 !important;
.navbar-dropdown { .navbar-dropdown {
box-shadow: $navbar-dropdown-boxed-shadow; box-shadow: $navbar-dropdown-boxed-shadow;
@ -11,6 +11,10 @@
.navbar-brand { .navbar-brand {
display: flex; display: flex;
align-items: center; align-items: center;
.logo img {
width: $vikunja-nav-logo-full-width;
}
} }
} }
@ -73,10 +77,6 @@
margin: 0 0.5rem; margin: 0 0.5rem;
} }
.navbar {
z-index: 4 !important;
}
.app-container { .app-container {
.namespace-container { .namespace-container {
background: $vikunja-nav-background; background: $vikunja-nav-background;
@ -327,11 +327,15 @@
.trigger-button { .trigger-button {
cursor: pointer; cursor: pointer;
color: $grey-400; color: $grey-400;
padding: 1rem; padding: .5rem;
font-size: 1.25rem; font-size: 1.25rem;
position: relative; position: relative;
} }
> * > .trigger-button {
width: $navbar-icon-width;
}
.user { .user {
span { span {
font-family: $vikunja-font; font-family: $vikunja-font;

View file

@ -29,6 +29,7 @@ $navbar-padding: 2rem;
$vikunja-nav-background: $light-background; $vikunja-nav-background: $light-background;
$vikunja-nav-color: $grey-700; $vikunja-nav-color: $grey-700;
$vikunja-nav-selected-width: 0.4rem; $vikunja-nav-selected-width: 0.4rem;
$vikunja-nav-logo-full-width: 164px;
$transition-duration: 150ms; $transition-duration: 150ms;
$transition: $transition-duration ease; $transition: $transition-duration ease;
@ -47,6 +48,7 @@ $hamburger-menu-icon-spacing: 1rem;
$hamburger-menu-icon-width: 28px; $hamburger-menu-icon-width: 28px;
$navbar-height: 4rem; $navbar-height: 4rem;
$navbar-width: 300px; $navbar-width: 300px;
$navbar-icon-width: 40px;
$editor-border-color: #ddd; $editor-border-color: #ddd;