Skip to content

Commit d8302fb

Browse files
committed
Refactor header styles to align with GOV.UK design system
1 parent 6532aaa commit d8302fb

2 files changed

Lines changed: 36 additions & 44 deletions

File tree

static/css/app.css

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -106,69 +106,61 @@ main {
106106
font-size: 16px;
107107
}
108108

109-
/* ---------- App header ---------- */
109+
/* ---------- GOV.UK header overrides ---------- */
110110

111-
.app-header__brand {
111+
/* Standard border is 1px transparent; ours is the 10px white bar */
112+
.govuk-header {
113+
border-bottom: 10px solid #fff;
114+
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
115+
}
116+
117+
/* Standard container is block with 0 15px padding; we need flex + our padding */
118+
.govuk-header__container--full-width {
119+
max-width: 1600px;
120+
margin: 0 auto;
121+
padding: 14px 24px;
122+
display: flex;
123+
align-items: flex-end;
124+
justify-content: space-between;
125+
gap: 24px;
126+
flex-wrap: wrap;
127+
}
128+
129+
/* Standard logo div stacks; we need it to flex the link + h1 side by side */
130+
.govuk-header__logo {
112131
display: flex;
113132
align-items: flex-end;
114133
gap: 16px;
134+
padding: 0;
115135
}
116136

117-
.app-header__logo {
118-
color: #fff;
119-
text-decoration: none;
120-
flex-shrink: 0;
137+
/* Standard link is display:inline; we need flex + right-side divider */
138+
.govuk-header__homepage-link {
121139
display: flex;
122140
align-items: flex-end;
123141
padding-right: 16px;
124142
padding-bottom: 2px;
125143
border-right: 1px solid rgba(255, 255, 255, 0.4);
144+
margin-bottom: 0;
126145
}
127146

128-
.app-header__logo svg {
129-
display: block;
147+
/* Reset the -3px offset from the standard logotype */
148+
.govuk-header__logotype {
149+
top: 0;
130150
width: 150px;
131151
height: 28px;
132-
flex-shrink: 0;
133-
}
134-
135-
.app-header__logo:focus-visible {
136-
outline: 3px solid var(--govuk-yellow);
137-
outline-offset: 2px;
138-
}
139-
140-
.govuk-logo-dot {
141-
fill: #00ffe0;
142-
}
143-
144-
.app-header {
145-
background: var(--govuk-blue);
146-
color: #fff;
147-
border-bottom: 10px solid #fff;
148-
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
149-
font-family: "GDS Transport", arial, sans-serif;
150-
}
151-
152-
.app-header__inner {
153-
max-width: 1600px;
154-
margin: 0 auto;
155-
padding: 14px 24px;
156-
display: flex;
157-
align-items: flex-end;
158-
justify-content: space-between;
159-
gap: 24px;
160-
flex-wrap: wrap;
161152
}
162153

163-
.app-header h1 {
154+
/* No design-system equivalent for a separate h1 beside the logo */
155+
.govuk-header h1 {
164156
margin: 0;
165157
font-size: 24px;
166158
line-height: 1.1;
167159
font-weight: 700;
168160
letter-spacing: -0.01em;
169161
}
170162

171-
.app-header .status {
163+
.govuk-header .status {
172164
margin: 4px 0 0;
173165
font-size: 14px;
174166
color: rgba(255, 255, 255, 0.85);

templates/base.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
{% block extra_head %}{% endblock %}
1010
</head>
1111
<body>
12-
<header class="app-header">
13-
<div class="app-header__inner">
14-
<div class="app-header__brand">
15-
<a href="{{ url_for('visualisations_page') }}" class="app-header__logo" aria-label="GOV.UK">
16-
<svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 324 60" height="28" width="150" fill="currentColor" aria-label="GOV.UK">
12+
<header class="govuk-header">
13+
<div class="govuk-header__container govuk-header__container--full-width">
14+
<div class="govuk-header__logo">
15+
<a href="{{ url_for('visualisations_page') }}" class="govuk-header__homepage-link" aria-label="GOV.UK">
16+
<svg class="govuk-header__logotype" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 324 60" height="28" width="150" fill="currentColor" aria-label="GOV.UK">
1717
<title>GOV.UK</title>
1818
<g>
1919
<circle cx="20" cy="17.6" r="3.7" />

0 commit comments

Comments
 (0)