Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update application header #211

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/src/assets/images/BCID_H_rgb_pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions frontend/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ label {
}
}

.p-menu .p-menuitem-link {
text-decoration: none !important;
}

.header-right .p-column-header-content {
justify-content: right;
}
Expand Down
70 changes: 70 additions & 0 deletions frontend/src/components/common/HeaderMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';

import { Button, Menu } from '@/lib/primevue';
import { storeToRefs } from 'pinia';
import { useAuthNStore } from '@/store';

import { type Ref } from 'vue';
import { RouteName } from '@/utils/enums/application';

// Store
const { getIsAuthenticated, getProfile } = storeToRefs(useAuthNStore());

// State
const { t } = useI18n();
const items = ref([
{
label: t('headerMenu.logout'),
icon: 'pi pi-sign-out',
command: () => {
router.push({ name: RouteName.OIDC_LOGOUT });
}
}
]);
const menu: Ref<Menu | undefined> = ref(undefined);

// Actions
const router = useRouter();

const toggle = (event: any) => {
menu.value?.toggle(event);
};
</script>

<template>
<div
v-if="getIsAuthenticated"
class="card flex justify-content-center"
>
<Button
id="menu-toggle"
type="button"
text
class="font-bold text-lg"
aria-haspopup="true"
aria-controls="overlay-menu"
@click="toggle"
>
{{ getProfile?.name }}
<font-awesome-icon
icon="fa-solid fa-bars"
class="ml-2 app-primary-color no-click"
/>
</Button>
<Menu
id="overlay-menu"
ref="menu"
:model="items"
:popup="true"
/>
</div>
</template>

<style lang="css" scoped>
.no-click {
pointer-events: none;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ onBeforeMount(async () => {
/>

<div class="flex justify-content-center app-primary-color mt-3">
<h3>Project Investigation Form</h3>
<h3>Housing Project Form</h3>
</div>

<Form
Expand Down
40 changes: 26 additions & 14 deletions frontend/src/components/layout/Header.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
<script setup lang="ts">
import { LoginButton } from '@/components/layout';
import { useI18n } from 'vue-i18n';

import HeaderMenu from '../common/HeaderMenu.vue';

// Actions
const { t } = useI18n();
</script>

<template>
<header>
<nav id="header-branding">
<div class="flex flex-row flex-wrap align-items-center p-2 lg:pl-6">
<div class="flex flex-row flex-wrap align-items-center lg:pl-6">
<div class="flex flex-none">
<a href="https://www2.gov.bc.ca">
<img
src="@/assets/images/bc_logo.svg"
width="181"
height="44"
src="@/assets/images/BCID_H_rgb_pos.png"
class="bc-logo"
alt="B.C. Government Logo"
/>
</a>
</div>
<div class="mx-2 bcds-header-line" />
<div class="flex flex-grow-1 ml-2">
<h2 class="m-0">Permit Connect Services</h2>
<h2 class="m-0 app-primary-color">{{ t('header.name') }}</h2>
</div>
<div class="flex flex-none lg:mr-6 ml-2">
<LoginButton />
<div class="flex justify-content-end lg:mr-6">
<HeaderMenu />
</div>
</div>
</nav>
</header>
</template>

<style lang="scss" scoped>
h2 {
color: rgba(255, 255, 255, 0.9) !important;
}

#header-branding {
background-color: #003366;
color: white;
background-color: white;
color: $app-primary;
white-space: nowrap;
box-shadow: 0 6px 8px -4px #b3b1b3;
-webkit-box-shadow: 0 6px 8px -4px #b3b1b3;
Expand All @@ -44,4 +45,15 @@ h2 {
border-bottom: 2px solid #fcba19;
}
}

.bc-logo {
max-height: 60px;
height: 60px;
}

.bcds-header-line {
background-color: #d8d8d8;
width: 1px;
height: 32px;
}
</style>
4 changes: 2 additions & 2 deletions frontend/src/components/layout/LoginButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function logout() {
</Button>
</template>

<style scoped>
<style lang="scss" scoped>
button {
color: white !important;
color: $app-primary !important;
}
</style>
1 change: 1 addition & 0 deletions frontend/src/lib/primevue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export { default as InputMask } from 'primevue/inputmask';
export { default as InputNumber } from 'primevue/inputnumber';
export { default as InputSwitch } from 'primevue/inputswitch';
export { default as InputText } from 'primevue/inputtext';
export { default as Menu } from 'primevue/menu';
export { default as Menubar } from 'primevue/menubar';
export { default as Message } from 'primevue/message';
export { default as Panel } from 'primevue/panel';
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/locales/en-CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"supervisor": "SUPERVISOR",
"admin": "ADMIN"
},
"header": {
"name": "Permit Connect Services"
},
"headerMenu": {
"logout": "Log out"
},
"loginButton": {
"login": "Log in",
"logout": "Log out"
Expand Down
8 changes: 7 additions & 1 deletion frontend/tests/unit/components/layout/Header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { shallowMount } from '@vue/test-utils';
import Header from '@/components/layout/Header.vue';
import { StorageKey } from '@/utils/enums/application';

// Mock router calls
// Mock dependencies
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: vi.fn()
})
}));

vi.mock('vue-router', () => ({
useRouter: () => ({
push: vi.fn()
Expand Down
Loading