Skip to content

Commit c2484d5

Browse files
Adjust navigation bar to use the updated design and fix some quirks (Fixes #520) (#567)
* Adjust navigation bar to use the updated design and fix some quirks (Fixes #520) * Revert dropdown's clickaway, and adjust styling so navbar remains consistently spaced. * console log removal * Fix horizontal scrollbar on desktop * Hide unnecessary navbar and footer links in subscribe page --------- Co-authored-by: Davi Nakano <davinakanoca@gmail.com>
1 parent 43eabe7 commit c2484d5

7 files changed

Lines changed: 71 additions & 59 deletions

File tree

assets/app/vue/components/FooterBar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const navItemsMail = [
4646
const currentRoute = useRoute();
4747
4848
const isThundermail = computed(() => currentRoute.path.startsWith('/mail'));
49+
const isSubscribePage = computed(() => currentRoute.path.startsWith('/subscribe'));
4950
const navItems = computed(() => isThundermail.value ? navItemsMail : navItemsAccounts);
5051
5152
// https://vite.dev/guide/assets.html#new-url-url-import-meta-url
@@ -66,7 +67,7 @@ const logoSrc = computed(() => {
6667
<img :src="logoSrc" :alt="isThundermail ? 'Thundermail' : 'Thunderbird Pro'" />
6768
</router-link>
6869
<ul>
69-
<template v-if="isAuthenticated">
70+
<template v-if="isAuthenticated && !isSubscribePage">
7071
<li v-for="navItem in navItems" :key="navItem.route">
7172
<router-link :to="navItem.route">
7273
{{ t(`navigationLinks.${navItem.i18nKey}`) }}

assets/app/vue/components/HeaderBar.vue

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,17 @@ const navItemsAccounts = [
1515
route: '/dashboard',
1616
i18nKey: 'dashboard',
1717
},
18-
// {
19-
// route: '/manage-mfa',
20-
// i18nKey: 'manageMfa',
21-
// },
22-
// {
23-
// route: '/privacy-and-data',
24-
// i18nKey: 'privacyAndData',
25-
// },
26-
];
27-
28-
const navItemsMail = [
2918
{
3019
route: '/mail',
31-
i18nKey: 'dashboard',
32-
},
33-
{
34-
route: '/mail#email-settings',
35-
i18nKey: 'manageEmails',
36-
},
37-
{
38-
route: '/mail#custom-domains',
39-
i18nKey: 'customDomains',
20+
i18nKey: 'manageThundermail',
4021
},
41-
// TODO: Uncomment when implementing security settings
42-
// {
43-
// route: '/mail/security-settings',
44-
// i18nKey: 'securitySettings',
45-
// },
4622
];
4723
4824
const currentRoute = useRoute();
4925
5026
const isThundermail = computed(() => currentRoute.path.startsWith('/mail'));
51-
const navItems = computed(() => isThundermail.value ? navItemsMail : navItemsAccounts);
27+
const isSubscribePage = computed(() => currentRoute.path.startsWith('/subscribe'));
28+
const navItems = computed(() => navItemsAccounts);
5229
5330
// https://vite.dev/guide/assets.html#new-url-url-import-meta-url
5431
const logoSrc = computed(() => {
@@ -74,7 +51,7 @@ const logoSrc = computed(() => {
7451
</template>
7552

7653
<template v-if="isAuthenticated">
77-
<nav class="desktop">
54+
<nav class="desktop" v-if="!isSubscribePage">
7855
<ul>
7956
<li v-for="navItem in navItems" :key="navItem.route">
8057
<router-link :to="navItem.route" :class="{ active: currentRoute.path === navItem.route }">
@@ -103,11 +80,25 @@ header {
10380
display: flex;
10481
align-items: center;
10582
justify-content: space-between;
83+
10684
height: 68px;
10785
padding: 1rem;
10886
backdrop-filter: blur(24px);
10987
box-shadow: 0 0.5rem 1.5rem 0 rgba(0, 0, 0, 0.1);
11088
background-image: linear-gradient(to top, #1a202c, #2f3a50);
89+
width: 100%;
90+
91+
/* Without this we can't be on top of main content when we need */
92+
position: relative;
93+
z-index: var(--z-index-header-dropdown);
94+
95+
&:first-child {
96+
margin-right: auto;
97+
}
98+
99+
&:last-child {
100+
margin-left: auto;
101+
}
111102
112103
nav.desktop {
113104
display: none;
@@ -117,7 +108,8 @@ header {
117108
text-decoration: none;
118109
119110
.brand.outline {
120-
color: #eeeef0; /* var(--colour-ti-base) dark mode */
111+
color: #eeeef0;
112+
/* var(--colour-ti-base) dark mode */
121113
}
122114
}
123115
@@ -148,13 +140,19 @@ header {
148140
header {
149141
nav.desktop {
150142
display: block;
143+
position: absolute;
144+
left: 50%;
145+
transform: translateX(-50%);
151146
}
152147
}
153148
}
154149
155150
@media (min-width: 1024px) {
156-
header {
151+
152+
header> :first-child,
153+
header> :last-child {
157154
padding: 1rem 3.5rem;
158155
}
156+
159157
}
160158
</style>

assets/app/vue/components/UserMenu.vue

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
<script setup lang="ts">
2-
import { ref, onMounted, onBeforeUnmount } from 'vue';
2+
import { onBeforeUnmount, onMounted, ref, useTemplateRef, computed } from 'vue';
33
import { useI18n } from 'vue-i18n';
4-
import { useRoute, useRouter } from 'vue-router';
4+
import { useRoute } from 'vue-router';
55
import { UserAvatar } from '@thunderbirdops/services-ui';
66
77
defineProps<{
88
username: string;
99
}>();
1010
1111
const { t } = useI18n();
12-
const router = useRouter();
1312
const currentRoute = useRoute();
1413
15-
const internalMenuItems = [
16-
{
17-
label: t('components.userMenu.contact'),
14+
const isSubscribePage = computed(() => currentRoute.path.startsWith('/subscribe'));
15+
16+
const internalMenuItems = computed(() => {
17+
const items = []
18+
19+
// Only show the account / dashboard link on non subscribe pages
20+
if (!isSubscribePage.value) {
21+
items.push({
22+
label: t('components.userMenu.account'),
23+
to: '/dashboard',
24+
});
25+
}
26+
27+
items.push({
28+
label: t('components.userMenu.support'),
1829
to: '/contact',
19-
},
20-
]
30+
});
31+
32+
return items;
33+
});
2134
2235
const externalMenuItems = [
2336
{
@@ -27,14 +40,9 @@ const externalMenuItems = [
2740
];
2841
2942
const showMenu = ref(false);
30-
const menuRef = ref<HTMLElement | null>(null);
43+
const menuRef = useTemplateRef<HTMLElement>('menuRef');
3144
3245
const toggleMenu = () => {
33-
if (currentRoute.path.startsWith('/mail')) {
34-
router.push('/');
35-
return;
36-
}
37-
3846
showMenu.value = !showMenu.value;
3947
};
4048
@@ -59,24 +67,17 @@ onBeforeUnmount(() => {
5967

6068
<div v-if="showMenu" class="dropdown">
6169
<!-- Holds internal links (VueJS routes) -->
62-
<router-link
63-
v-for="internalItem in internalMenuItems"
64-
:key="internalItem.label"
65-
:to="internalItem.to"
66-
>
70+
<router-link v-for="internalItem in internalMenuItems" :key="internalItem.label" :to="internalItem.to"
71+
@click="toggleMenu">
6772
{{ internalItem.label }}
6873
</router-link>
6974

7075
<!-- Holds external links (primarily Django routes) -->
71-
<a
72-
v-for="externalItem in externalMenuItems"
73-
:key="externalItem.label"
74-
:href="externalItem.href"
75-
>
76+
<a v-for="externalItem in externalMenuItems" :key="externalItem.label" :href="externalItem.href">
7677
{{ externalItem.label }}
7778
</a>
7879
</div>
79-
</button>
80+
</button>
8081
</template>
8182

8283
<style scoped>
@@ -85,12 +86,14 @@ onBeforeUnmount(() => {
8586
display: inline-block;
8687
background: none;
8788
border: none;
88-
cursor: pointer;
8989
9090
/* TODO: Temporary fix for UserAvatar color bug */
9191
.avatar {
92+
cursor: pointer;
93+
9294
& :first-child {
93-
color: #eeeef0; /* var(--colour-ti-base) dark mode */
95+
color: #eeeef0;
96+
/* var(--colour-ti-base) dark mode */
9497
}
9598
}
9699
@@ -104,6 +107,7 @@ onBeforeUnmount(() => {
104107
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
105108
padding: 0.5rem 0;
106109
min-width: 150px;
110+
z-index: var(--z-index-header-dropdown);
107111
108112
a {
109113
display: flex;

assets/app/vue/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"navigationLinks": {
33
"dashboard": "Dashboard",
4+
"manageThundermail": "Manage Thundermail",
45
"manageMfa": "Manage MFA",
56
"privacyAndData": "Privacy & Data",
67
"manageEmails": "Manage Emails",
@@ -16,7 +17,8 @@
1617
"yourServices": "Your Services"
1718
},
1819
"userMenu": {
19-
"contact": "Contact",
20+
"account": "Account",
21+
"support": "Support",
2022
"logout": "Logout"
2123
}
2224
},

assets/app/vue/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export enum SERVER_MESSAGE_LEVEL {
1010
export type ServerMessage = {
1111
level: SERVER_MESSAGE_LEVEL;
1212
message: string;
13-
};
13+
};

assets/css/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import 'fonts.css';
2+
@import "variables.css";
23

34
*,
45
*::before,

assets/css/variables.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:root {
2+
/* Z-index definitions */
3+
--z-index-base: 1;
4+
--z-index-header-dropdown: 10;
5+
--z-index-fullscreen-clickbox: calc(var(--z-index-header-dropdown, 0) - 1);
6+
}

0 commit comments

Comments
 (0)