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

Back links and breadcrumbs tweaks #1002

Merged
merged 24 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
920e844
Adjust spacing for back link
frankieroberto Jun 10, 2024
1a278b5
Update back link examples
frankieroberto Jun 10, 2024
37533ac
Update changelog
frankieroberto Jun 10, 2024
0e062b5
Merge branch 'main' into adjust-spacing-for-back-link
frankieroberto Jun 18, 2024
99222f6
Revert to default margin-bottom
frankieroberto Jun 19, 2024
9ddebc1
Move breadcrumb inside nhsuk-width-container
frankieroberto Jun 21, 2024
1ecbedd
Remove .nhsuk-width-container from breadcrumb
frankieroberto Jun 21, 2024
22c78f1
Update breadcrumb to use margins instead of padding
frankieroberto Jun 21, 2024
e3a266f
Merge branch 'main' into adjust-spacing-for-back-link
frankieroberto Jul 9, 2024
4ca27f3
Fix changelog style
frankieroberto Jul 9, 2024
3b25424
Merge branch 'main' into move-breadcrumb-inside-width-container
frankieroberto Jul 15, 2024
7e68b40
Merge branch 'main' into adjust-spacing-for-back-link
frankieroberto Aug 20, 2024
9b0eb9c
Merge branch 'main' of https://github.com/nhsuk/nhsuk-frontend into m…
anandamaryon1 Aug 28, 2024
63342c9
Merge branch 'adjust-spacing-for-back-link' of https://github.com/nhs…
anandamaryon1 Aug 28, 2024
b6caacf
merge
anandamaryon1 Aug 28, 2024
396ff95
spacing and example tweaks
anandamaryon1 Aug 28, 2024
125fc92
remove underline on breadcrumb back link, to match back link. Plus sp…
anandamaryon1 Aug 28, 2024
0a74acf
attempt to fix linting build error
anandamaryon1 Aug 28, 2024
bb1b715
Rename outerContent as beforeContent
frankieroberto Aug 28, 2024
219b1e8
update reference images
roshaanbajwa Aug 29, 2024
99775bf
Use page template in examples
frankieroberto Aug 30, 2024
9568dce
Merge branch 'main' into back-links-and-breadcrumbs
anandamaryon1 Sep 9, 2024
7ee6c1c
remove testing markup from component examples
anandamaryon1 Sep 9, 2024
f9b9e97
backstop refs
anandamaryon1 Sep 9, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Fix Sass deprecation on `mix` function (passing a number without unit) ([PR 995](https://github.com/nhsuk/nhsuk-frontend/pull/995))
- Add nhsukAttributes macro, copied from GOV.UK ([PR 998](https://github.com/nhsuk/nhsuk-frontend/pull/998))
- Change "Contact us" in the footer link examples to "Give us feedback" ([PR 972](https://github.com/nhsuk/nhsuk-frontend/pull/972))
- Adjusted default spacing of back link component. ([PR 964](https://github.com/nhsuk/nhsuk-frontend/pull/964))

## 8.3.0 - 24 July 2024

Expand Down
3 changes: 1 addition & 2 deletions app/_templates/page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@

{% block body %}

{% block breadcrumb %}{% endblock %}

<div class="nhsuk-width-container">
{% block beforeContent %}{% endblock %}
<main class="nhsuk-main-wrapper" id="maincontent">

<div class="nhsuk-grid-row">
Expand Down
2 changes: 1 addition & 1 deletion app/components/all.njk
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}}
{% endblock %}

{% block breadcrumb %}
{% block beforeContent %}
{{ breadcrumb({
items: [
{
Expand Down
2 changes: 1 addition & 1 deletion app/components/back-link/button.njk
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
</main>
</div>

{% endblock %}
{% endblock %}
8 changes: 6 additions & 2 deletions app/components/back-link/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
{{ backLink({
"href": "#",
"text": "Go back"
href: "#",
text: "Go back"
}) }}
</div>
</div>

</main>
</div>

{% endblock %}

{% block heading %}
<h1 class="govuk-heading-l">Page title</h1>
{% endblock %}
58 changes: 36 additions & 22 deletions app/components/breadcrumb/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,41 @@

{% block body %}

{{ breadcrumb({
items: [
{
href: "#",
text: "Level one",
attributes: {lang: "en"}
},
{
href: "#",
text: "Level two"
},
{
href: "#",
text: "Level three",
attributes: {lang: "en"}
}
],
href: "#",
text: "Level four",
classes: "example-class-one example-class-two",
attributes: {lang: "en"}
}) }}
<div class="nhsuk-width-container">
<main class="nhsuk-main-wrapper" id="maincontent">

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
{{ breadcrumb({
items: [
{
href: "#",
text: "Level one",
attributes: {lang: "en"}
},
{
href: "#",
text: "Level two"
},
{
href: "#",
text: "Level three",
attributes: {lang: "en"}
}
],
href: "#",
text: "Level four",
classes: "example-class-one example-class-two",
attributes: {lang: "en"}
}) }}
</div>
</div>

</main>
</div>

{% endblock %}

{% block heading %}
<h1 class="govuk-heading-l">Page title</h1>
{% endblock %}
2 changes: 1 addition & 1 deletion app/pages/about.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ super() }}
{% endblock %}

{% block breadcrumb %}
{% block beforeContent %}
{{ breadcrumb({
items: [
{
Expand Down
2 changes: 1 addition & 1 deletion app/pages/examples.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ super() }}
{% endblock %}

{% block breadcrumb %}
{% block beforeContent %}
{{ breadcrumb({
items: [
{
Expand Down
2 changes: 1 addition & 1 deletion app/pages/install.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ super() }}
{% endblock %}

{% block breadcrumb %}
{% block beforeContent %}
{{ breadcrumb({
items: [
{
Expand Down
2 changes: 1 addition & 1 deletion app/styles/lists.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ super() }}
{% endblock %}

{% block breadcrumb %}
{% block beforeContent %}
{{ breadcrumb({
items: [
{
Expand Down
12 changes: 11 additions & 1 deletion packages/components/back-link/_back-link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
* 1. Allow space for the arrow.
* 2. Align the icon with the start of the back link.
* 3. Align the icon with the middle of the text.
* 4. Make back link same height as breadcrumb.
*/

.nhsuk-back-link {
margin-bottom: nhsuk-spacing(3);
margin-top: nhsuk-spacing(3);
line-height: 1; /* 4 */

@include mq($from: tablet) {
margin-top: nhsuk-spacing(4);
}
}

.nhsuk-back-link__link {
Expand All @@ -30,6 +36,10 @@
position: absolute;
top: -1px; /* 3 */
width: 24px;

@include mq($from: tablet) {
top: 0; /* 3 */
}
}

&:visited {
Expand Down
15 changes: 7 additions & 8 deletions packages/components/breadcrumb/_breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

/**
* 1. Hide the breadcrumb on print stylesheets.
* 2. Bespoke spacing numbers used as there is no 20px
* spacing mapped in settings/spacing.
* 3. Don't show the full breadcrumb below tablet size.
* 4. Typography sizing mixin, see core/tools/_typography
* 5. and core/settings/_typography for size maps.
Expand All @@ -14,12 +12,10 @@

.nhsuk-breadcrumb {
@include print-hide(); /* [1] */
margin-top: nhsuk-spacing(3);

padding-bottom: nhsuk-spacing(3);
padding-top: 20px; /* [2] */

+ .nhsuk-width-container .nhsuk-main-wrapper {
padding-top: 0;
@include mq($from: tablet) {
margin-top: nhsuk-spacing(4);
}
}

Expand All @@ -28,6 +24,7 @@
display: none; /* [3] */
}

@include nhsuk-font(16); /* [4] */
list-style: none;
margin: 0;
padding: 0;
Expand Down Expand Up @@ -84,12 +81,14 @@
height: 18px;
left: 0;
position: absolute;
top: 0;
top: -1px;
width: 10px;
}
}

.nhsuk-breadcrumb__backlink {
text-decoration: none;

&:visited {
color: $nhsuk-link-color;

Expand Down
46 changes: 22 additions & 24 deletions packages/components/breadcrumb/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

<nav class="nhsuk-breadcrumb{% if params.classes %} {{ params.classes }}{% endif %}" aria-label="Breadcrumb"
{{- nhsukAttributes(params.attributes) }}>
<div class="nhsuk-width-container">
<ol class="nhsuk-breadcrumb__list">
{%- for item in params.items %}
{%- if item.href %}
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="{{ item.href }}" {{- nhsukAttributes(item.attributes) }}>{{ item.text }}</a>{% if not loop.last %}{% endif %}</li>
{%- endif -%}
{% endfor %}
{% if params.href %}
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="{{ params.href }}">{{ params.text}}</a></li>
{% set lastHref = params.href %}
{% set lastText = params.text %}
{% else %}
{% set lastItem = params.items | last%}
{% set lastHref = lastItem.href %}
{% set lastText = lastItem.text %}
{% endif %}
</ol>
<p class="nhsuk-breadcrumb__back">
<a class="nhsuk-breadcrumb__backlink" href="{{ lastHref }}" {{- nhsukAttributes(lastItem.attributes) }}>
<span class="nhsuk-u-visually-hidden">Back to &nbsp;</span>
{{ lastText }}
</a>
</p>
</div>
<ol class="nhsuk-breadcrumb__list">
{%- for item in params.items %}
{%- if item.href %}
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="{{ item.href }}" {{- nhsukAttributes(item.attributes) }}>{{ item.text }}</a>{% if not loop.last %}{% endif %}</li>
{%- endif -%}
{% endfor %}
{% if params.href %}
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="{{ params.href }}">{{ params.text}}</a></li>
{% set lastHref = params.href %}
{% set lastText = params.text %}
{% else %}
{% set lastItem = params.items | last%}
{% set lastHref = lastItem.href %}
{% set lastText = lastItem.text %}
{% endif %}
</ol>
<p class="nhsuk-breadcrumb__back">
<a class="nhsuk-breadcrumb__backlink" href="{{ lastHref }}" {{- nhsukAttributes(lastItem.attributes) }}>
<span class="nhsuk-u-visually-hidden">Back to &nbsp;</span>
{{ lastText }}
</a>
</p>
</nav>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading