Skip to content

Commit 77a9be6

Browse files
frankierobertoowenatgov
authored andcommitted
Add interruption panel variant
1 parent eff9347 commit 77a9be6

3 files changed

Lines changed: 41 additions & 7 deletions

File tree

packages/govuk-frontend/src/govuk/components/panel/_index.scss

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
// it but the the text remains legible.
3333
overflow-wrap: break-word;
3434
}
35-
}
36-
37-
.govuk-panel--confirmation {
38-
color: govuk-colour("white");
39-
background: govuk-colour("green");
4035

4136
@media print {
4237
border-color: currentcolor;
@@ -45,6 +40,11 @@
4540
}
4641
}
4742

43+
.govuk-panel--confirmation {
44+
color: govuk-colour("white");
45+
background: govuk-colour("green");
46+
}
47+
4848
.govuk-panel__title {
4949
@include govuk-font-size($size: 48);
5050
@include govuk-typography-weight-bold;
@@ -55,4 +55,12 @@
5555
.govuk-panel__title:last-child {
5656
margin-bottom: 0;
5757
}
58+
59+
.govuk-panel--interruption {
60+
color: govuk-colour("white");
61+
background-color: $govuk-brand-colour;
62+
text-align: left;
63+
64+
@include govuk-font($size: 19);
65+
}
5866
}

packages/govuk-frontend/src/govuk/components/panel/panel.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ examples:
3838
options:
3939
titleHtml: Application complete
4040
text: 'Your reference number: HDJ2123F'
41+
- name: custom heading level
42+
options:
43+
titleText: Application complete
44+
headingLevel: 2
45+
text: 'Your reference number: HDJ2123F'
46+
- name: interruption
47+
options:
48+
titleText: Is your weight correct?
49+
html: |
50+
<p>You entered your age as <strong>109</strong>.</p>
51+
<div class="govuk-button-group">
52+
<button type="submit" class="govuk-button govuk-button--inverse" data-module="govuk-button">
53+
Yes, this is correct
54+
</button>
55+
<a href="#" class="govuk-link govuk-link--inverse">Change my age</a>
56+
</div>
57+
classes: govuk-panel--interruption
4158

4259
# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
4360
- name: title html as text

packages/govuk-frontend/src/govuk/components/panel/template.njk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22

33
{% set headingLevel = params.headingLevel if params.headingLevel else 1 -%}
44

5-
<div class="govuk-panel govuk-panel--confirmation
6-
{%- if params.classes %} {{ params.classes }}{% endif %}"
5+
{%- set classNames = "govuk-panel" -%}
6+
7+
{%- if params.classes %}
8+
{% set classNames = classNames + " " + params.classes %}
9+
{% endif %}
10+
11+
{%- if (not params.classes) or (not "govuk-panel--interruption" in params.classes) %}
12+
{% set classNames = classNames + " govuk-panel--confirmation" -%}
13+
{% endif %}
14+
15+
<div class="{{ classNames }}"
716
{{- govukAttributes(params.attributes) }}>
817
<h{{ headingLevel }} class="govuk-panel__title">
918
{{ params.titleHtml | safe if params.titleHtml else params.titleText }}

0 commit comments

Comments
 (0)