-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add side navigation * Do not compile sass files that start with an underscore * Use eleventy collections for sidebar nav * Remove unused app-prose-scope class --------- Co-authored-by: Mike Monteith <mike@mikemonteith.com>
- Loading branch information
1 parent
160603c
commit 9c081f4
Showing
9 changed files
with
207 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% extends "./base.njk" %} | ||
|
||
{%- from "./partials/side-navigation.njk" import appSideNavigation %} | ||
|
||
{% block content %} | ||
<div class="nhsuk-width-container"> | ||
<div class="nhsuk-grid-row"> | ||
<div class="nhsuk-grid-column-one-third"> | ||
{{ appSideNavigation({ | ||
currentPath: page.url | url, | ||
classes: 'app-side-navigation--desktop nhsuk-u-padding-top-6', | ||
sections: [ | ||
{ | ||
heading: { | ||
text: "Components" | ||
}, | ||
items: collections.component | ||
} | ||
] | ||
}) }} | ||
</div> | ||
<div class="nhsuk-grid-column-two-thirds"> | ||
<main id="main-content" class="nhsuk-main-wrapper" role="main"> | ||
<h1 class="nhsuk-heading-xl"> | ||
{% if not isIndex %}<span class="nhsuk-caption-xl">Components</span>{% endif %} | ||
{{ title }} | ||
</h1> | ||
{{ content | safe }} | ||
|
||
{{ appSideNavigation({ | ||
classes: 'app-side-navigation--mobile', | ||
currentPath: page.url | url, | ||
sections: [ | ||
{ | ||
heading: { | ||
text: "Components" | ||
}, | ||
items: collections.component | ||
} | ||
] | ||
}) }} | ||
</main> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% set active = item.url === params.currentPath %} | ||
|
||
<li class="app-side-navigation__item{% if active %} app-side-navigation__item--active{% endif %}"{% for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
<a href="{{ item.url }}"{% if active %} aria-current="location"{% endif %}> | ||
{{- item.data.title -}} | ||
</a> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% macro appSideNavigation(params) %} | ||
<nav class="app-side-navigation {{- ' ' + params.classes if params.classes }}" {%- if (params.label) %} aria-label="{{ params.label }}"{% endif %} {% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
{%- if params.sections %} | ||
{%- for section in params.sections %} | ||
<h{{ section.heading.headingLevel | default(4) }} class="app-side-navigation__title {{- ' ' + section.heading.classes if section.heading.classes }}"{% for attribute, value in section.heading.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
{{- section.heading.html | safe if section.heading.html else section.heading.text -}} | ||
</h{{ section.heading.headingLevel | default(4) }}> | ||
<ul class="app-side-navigation__list"> | ||
{%- for item in section.items %} | ||
{% include "./side-navigation-item.njk" %} | ||
{% endfor -%} | ||
</ul> | ||
{% endfor -%} | ||
{% else %} | ||
<ul class="app-side-navigation__list"> | ||
{%- for item in params.items %} | ||
{% include "./side-navigation-item.njk" %} | ||
{% endfor -%} | ||
</ul> | ||
{% endif -%} | ||
</nav> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* ========================================================================== | ||
#SIDE NAVIGATION | ||
========================================================================== */ | ||
|
||
.app-side-navigation { | ||
@include nhsuk-font($size: 16); | ||
|
||
display: block; | ||
margin-left: - nhsuk-spacing(2); | ||
padding: nhsuk-spacing(4) 0 0; | ||
} | ||
|
||
.app-side-navigation__title { | ||
@include nhsuk-font($size: 19); | ||
color: $color_nhsuk-grey-2; | ||
font-weight: normal; | ||
margin: 0; | ||
padding: nhsuk-spacing(2); | ||
padding-left: nhsuk-spacing(2) + 4px; | ||
} | ||
|
||
.app-side-navigation__list { | ||
list-style: none; | ||
margin: 0 0 nhsuk-spacing(4); | ||
padding: 0; | ||
} | ||
|
||
.app-side-navigation__item { | ||
@include nhsuk-font($size: 16); | ||
|
||
a, | ||
a:link, | ||
a:visited { | ||
border-left: 4px solid transparent; | ||
color: $nhsuk-link-color; | ||
display: block; | ||
padding: nhsuk-spacing(1) nhsuk-spacing(2); | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
color: $nhsuk-link-hover-color; | ||
} | ||
|
||
a:focus { | ||
background-color: $nhsuk-focus-color; | ||
border-color: $nhsuk-focus-text-color; | ||
box-shadow: none; | ||
color: $nhsuk-focus-text-color; | ||
position: relative; | ||
} | ||
} | ||
|
||
.app-side-navigation__item--active { | ||
a:link, | ||
a:visited { | ||
border-color: $nhsuk-link-color; | ||
color: $nhsuk-link-color; | ||
font-weight: bold; | ||
} | ||
|
||
a:hover { | ||
border-color: $nhsuk-link-hover-color; | ||
color: $nhsuk-link-hover-color; | ||
} | ||
|
||
a:focus { | ||
background-color: $nhsuk-focus-color; | ||
border-color: $nhsuk-focus-text-color; | ||
box-shadow: none; | ||
color: $nhsuk-focus-text-color; | ||
} | ||
} | ||
|
||
.app-side-navigation--desktop { | ||
@include mq($until: desktop) { | ||
display: none; | ||
} | ||
} | ||
|
||
.app-side-navigation--mobile { | ||
@include mq($from: desktop) { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
--- | ||
layout: layouts/plain.njk | ||
layout: layouts/component.njk | ||
isIndex: true | ||
title: Components | ||
--- | ||
|
||
[Card links](./card-links) | ||
Components are reusable elements of the user interface. | ||
|
||
Individual components can be used in multiple different pages, patterns and context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters