From 09458b7899e05a942437e5b668c9b42ada10c2bd Mon Sep 17 00:00:00 2001 From: jamesgrant-moj <116157538+jamesgrant-moj@users.noreply.github.com> Date: Fri, 9 Jun 2023 09:20:13 +0100 Subject: [PATCH] CDPS-177 add old header (#151) * CDPS-177 - header in progress * CDPS-177-add-old-header * CDPS-177-add-old-header --- assets/scss/components/_header-bar.scss | 26 +++++++++++++----------- server/utils/nunjucksSetup.ts | 2 ++ server/utils/utils.test.ts | 6 ++++++ server/utils/utils.ts | 5 +++++ server/views/partials/header.njk | 27 +++++++++++++------------ 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/assets/scss/components/_header-bar.scss b/assets/scss/components/_header-bar.scss index d8c6c5903..542c750b5 100644 --- a/assets/scss/components/_header-bar.scss +++ b/assets/scss/components/_header-bar.scss @@ -3,10 +3,6 @@ @include govuk-responsive-padding(3, 'bottom'); background-color: govuk-colour('black'); - .hmpps-header__link__main-text { - color: govuk-colour('white'); - margin-bottom: 0; - } &__container { @include govuk-width-container; display: flex; @@ -112,6 +108,7 @@ border-right: 0; padding-right: 0; } + } } @@ -120,27 +117,32 @@ } } -.location-bar { +.hmpps-location-bar { @include govuk-width-container; @include govuk-responsive-margin(3, 'bottom'); @include govuk-responsive-padding(3, 'top'); @include govuk-responsive-padding(3, 'bottom'); + width: 100%; - display: flex; + display: flex!important; flex-wrap: wrap; - border-bottom: 1px solid $govuk-border-colour; - - &__location { + .location-bar__location { @include govuk-font($size: 19, $weight: 'bold'); @include govuk-responsive-margin(3, 'right'); + @include govuk-responsive-margin(0, 'bottom'); } - - &__link { + a{ @include govuk-link-common; @include govuk-link-style-default; @include govuk-font($size: 19, $weight: 'normal'); + height: fit-content; } + width: 100%; + display: flex; + flex-wrap: wrap; + border-bottom: 1px solid $govuk-border-colour; + @media print { display: none; } @@ -330,4 +332,4 @@ } } } -} +} \ No newline at end of file diff --git a/server/utils/nunjucksSetup.ts b/server/utils/nunjucksSetup.ts index 18a626d48..5a00aef1e 100644 --- a/server/utils/nunjucksSetup.ts +++ b/server/utils/nunjucksSetup.ts @@ -12,6 +12,7 @@ import { userHasRoles, apostrophe, prependBaseUrl, + prependHmppsAuthBaseUrl, } from './utils' import { pluralise } from './pluralise' import { formatDate, formatDateTime } from './dateHelpers' @@ -93,4 +94,5 @@ export default function nunjucksSetup(app: express.Express, path: pathModule.Pla njkEnv.addFilter('apostrophe', apostrophe) njkEnv.addFilter('prependBaseUrl', prependBaseUrl) + njkEnv.addFilter('prependHmppsAuthBaseUrl', prependHmppsAuthBaseUrl) } diff --git a/server/utils/utils.test.ts b/server/utils/utils.test.ts index a558e6c13..84e7a6983 100644 --- a/server/utils/utils.test.ts +++ b/server/utils/utils.test.ts @@ -12,6 +12,7 @@ import { initialiseName, mapToQueryString, prependBaseUrl, + prependHmppsAuthBaseUrl, prisonerBelongsToUsersCaseLoad, properCaseName, summaryListOneHalfWidth, @@ -344,4 +345,9 @@ describe('findError', () => { const route = '/prisoner' expect(prependBaseUrl(route)).toEqual(`${config.serviceUrls.digitalPrison}${route}`) }) + + describe('prependHmppsAuthBaseUrl', () => { + const route = '/account-details' + expect(prependHmppsAuthBaseUrl(route)).toEqual(`${config.apis.hmppsAuth.url}${route}`) + }) }) diff --git a/server/utils/utils.ts b/server/utils/utils.ts index 45d28ed47..912030fe0 100644 --- a/server/utils/utils.ts +++ b/server/utils/utils.ts @@ -384,6 +384,11 @@ export const prependBaseUrl = (url: string): string => { return urlWithBaseUrl } +export const prependHmppsAuthBaseUrl = (url: string): string => { + const urlWithHmppsAuthBaseUrl = `${config.apis.hmppsAuth.url}${url}` + return urlWithHmppsAuthBaseUrl +} + /** * Returns a description for specific category codes, otherwise just the code. * diff --git a/server/views/partials/header.njk b/server/views/partials/header.njk index 4846c741f..15dec457a 100644 --- a/server/views/partials/header.njk +++ b/server/views/partials/header.njk @@ -16,20 +16,9 @@ + +
+
+

{{ user.activeCaseLoad[0].description }}

+ {% if user.caseLoads.length > 1 %} + + Change your location + + {% endif %} +
+
+