govuk_publishing_components 12.20.0 → 12.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +8 -0
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +8 -8
- data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +10 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -14
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -3
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +10 -6
- data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +3 -2
- data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +71 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -9
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
- data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +53 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +10 -5
- data/config/locales/en.yml +5 -6
- data/lib/govuk_publishing_components.rb +0 -2
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +108 -90
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/components/back-link/README.md +4 -73
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +4 -238
- data/node_modules/govuk-frontend/components/button/README.md +4 -174
- data/node_modules/govuk-frontend/components/character-count/README.md +4 -340
- data/node_modules/govuk-frontend/components/character-count/template.njk +0 -3
- data/node_modules/govuk-frontend/components/checkboxes/README.md +4 -705
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +1 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +4 -563
- data/node_modules/govuk-frontend/components/date-input/template.njk +1 -0
- data/node_modules/govuk-frontend/components/details/README.md +4 -128
- data/node_modules/govuk-frontend/components/error-message/README.md +4 -58
- data/node_modules/govuk-frontend/components/error-summary/README.md +4 -94
- data/node_modules/govuk-frontend/components/fieldset/README.md +4 -92
- data/node_modules/govuk-frontend/components/file-upload/README.md +4 -199
- data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -0
- data/node_modules/govuk-frontend/components/footer/README.md +4 -91
- data/node_modules/govuk-frontend/components/footer/_footer.scss +22 -13
- data/node_modules/govuk-frontend/components/header/README.md +4 -351
- data/node_modules/govuk-frontend/components/hint/README.md +5 -77
- data/node_modules/govuk-frontend/components/input/README.md +4 -407
- data/node_modules/govuk-frontend/components/input/template.njk +1 -0
- data/node_modules/govuk-frontend/components/inset-text/README.md +4 -76
- data/node_modules/govuk-frontend/components/label/README.md +5 -97
- data/node_modules/govuk-frontend/components/panel/README.md +4 -93
- data/node_modules/govuk-frontend/components/phase-banner/README.md +4 -67
- data/node_modules/govuk-frontend/components/radios/README.md +4 -665
- data/node_modules/govuk-frontend/components/radios/template.njk +1 -0
- data/node_modules/govuk-frontend/components/select/README.md +4 -257
- data/node_modules/govuk-frontend/components/select/template.njk +1 -0
- data/node_modules/govuk-frontend/components/skip-link/README.md +4 -57
- data/node_modules/govuk-frontend/components/table/README.md +4 -368
- data/node_modules/govuk-frontend/components/tabs/README.md +4 -242
- data/node_modules/govuk-frontend/components/tag/README.md +4 -77
- data/node_modules/govuk-frontend/components/textarea/README.md +4 -193
- data/node_modules/govuk-frontend/components/textarea/template.njk +1 -0
- data/node_modules/govuk-frontend/components/warning-text/README.md +4 -63
- data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +1 -2
- data/node_modules/govuk-frontend/core/_lists.scss +17 -8
- data/node_modules/govuk-frontend/package.json +10 -10
- metadata +4 -5
- data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +0 -116
- data/app/views/govuk_publishing_components/components/docs/taxonomy_navigation.yml +0 -119
- data/lib/govuk_publishing_components/presenters/taxonomy_navigation.rb +0 -47
@@ -16,10 +16,6 @@ module GovukPublishingComponents
|
|
16
16
|
content_item['document_type'] === "simple_smart_answer"
|
17
17
|
end
|
18
18
|
|
19
|
-
def taxonomy_sidebar
|
20
|
-
@taxonomy_sidebar ||= TaxonomyNavigation.new(content_item).sidebar
|
21
|
-
end
|
22
|
-
|
23
19
|
def taxon_breadcrumbs
|
24
20
|
@taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.new(content_item).breadcrumbs
|
25
21
|
end
|
@@ -13,35 +13,69 @@ module GovukPublishingComponents
|
|
13
13
|
statistical_data_sets
|
14
14
|
).freeze
|
15
15
|
|
16
|
-
def initialize(content_item)
|
16
|
+
def initialize(content_item:, context: nil)
|
17
17
|
@content_item = content_item
|
18
|
+
@context = context
|
18
19
|
end
|
19
20
|
|
20
21
|
def related_navigation
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
case @context.try(:to_sym)
|
23
|
+
when :sidebar
|
24
|
+
{
|
25
|
+
"related_items" => related_items,
|
26
|
+
"related_guides" => related_guides,
|
27
|
+
"collections" => related_document_collections,
|
28
|
+
}
|
29
|
+
when :footer
|
30
|
+
{
|
31
|
+
"topics" => related_topics,
|
32
|
+
"topical_events" => related_topical_events,
|
33
|
+
"world_locations" => related_world_locations,
|
34
|
+
"statistical_data_sets" => related_statistical_data_sets,
|
35
|
+
"related_external_links" => related_external_links,
|
36
|
+
"related_contacts" => related_contacts,
|
37
|
+
}
|
38
|
+
else
|
39
|
+
{
|
40
|
+
"related_items" => related_items,
|
41
|
+
"related_guides" => related_guides,
|
42
|
+
"collections" => related_document_collections,
|
43
|
+
"topics" => related_topics,
|
44
|
+
"topical_events" => related_topical_events,
|
45
|
+
"world_locations" => related_world_locations,
|
46
|
+
"statistical_data_sets" => related_statistical_data_sets,
|
47
|
+
"related_external_links" => related_external_links,
|
48
|
+
"related_contacts" => related_contacts,
|
49
|
+
}
|
50
|
+
end
|
32
51
|
end
|
33
52
|
|
34
53
|
def construct_section_heading(section_title)
|
35
54
|
unless section_title === "related_items"
|
36
|
-
I18n.t(
|
55
|
+
I18n.t("components.related_#{@context}_navigation." + section_title,
|
56
|
+
default: [
|
57
|
+
I18n.t('components.related_navigation.' + section_title),
|
58
|
+
section_title.tr('_', ' '),
|
59
|
+
])
|
37
60
|
end
|
38
61
|
end
|
39
62
|
|
40
63
|
def section_css_class(css_class, section_title, link = {})
|
64
|
+
css_classes = [css_class, "#{css_class}--#{@context}"]
|
65
|
+
|
41
66
|
unless DEFINED_SECTIONS.include?(section_title) || link.fetch(:finder, false)
|
42
|
-
|
67
|
+
css_classes << " #{css_class}--other"
|
43
68
|
end
|
44
|
-
|
69
|
+
|
70
|
+
css_classes.join(' ')
|
71
|
+
end
|
72
|
+
|
73
|
+
def section_data_track_count(section_title)
|
74
|
+
String(@context || 'sidebar') + String(section_title).camelcase
|
75
|
+
end
|
76
|
+
|
77
|
+
def section_heading_level
|
78
|
+
@context == :footer ? 'h2' : 'h3'
|
45
79
|
end
|
46
80
|
|
47
81
|
def calculate_section_link_limit(links)
|
@@ -52,121 +86,105 @@ module GovukPublishingComponents
|
|
52
86
|
links.length - MAX_SECTION_LENGTH
|
53
87
|
end
|
54
88
|
|
55
|
-
def
|
89
|
+
def related_navigation?
|
56
90
|
related_navigation.flat_map(&:last).any?
|
57
91
|
end
|
58
92
|
|
59
93
|
private
|
60
94
|
|
61
|
-
def build_links_for_sidebar(collection, path_key = "base_path", additional_attr = {})
|
62
|
-
collection.map do |link|
|
63
|
-
{
|
64
|
-
path: link[path_key],
|
65
|
-
text: link["title"]
|
66
|
-
}.merge(additional_attr)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def world_location_base_path(title)
|
71
|
-
"/world/#{parameterise(title)}/news"
|
72
|
-
end
|
73
|
-
|
74
95
|
def related_items
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
links + mainstream_links
|
96
|
+
related_quick_links = content_item_details_for('quick_links')
|
97
|
+
|
98
|
+
if related_quick_links.any?
|
99
|
+
related_quick_links + related_mainstream_content
|
80
100
|
else
|
81
|
-
|
101
|
+
content_item_links_for('ordered_related_items') + related_mainstream_content
|
82
102
|
end
|
83
103
|
end
|
84
104
|
|
85
|
-
def quick_links
|
86
|
-
@content_item.dig("details", "quick_links").to_a
|
87
|
-
end
|
88
|
-
|
89
105
|
def related_world_locations
|
90
|
-
|
91
|
-
|
92
|
-
build_links_for_sidebar(locations)
|
106
|
+
content_item_links_for('world_locations')
|
107
|
+
.map { |link| link.merge(path: "/world/#{link[:text].parameterize}/news") }
|
93
108
|
end
|
94
109
|
|
95
|
-
def
|
96
|
-
|
97
|
-
build_links_for_sidebar(collections)
|
110
|
+
def related_statistical_data_sets
|
111
|
+
content_item_links_for('related_statistical_data_sets', only: 'statistical_data_set')
|
98
112
|
end
|
99
113
|
|
100
|
-
def
|
101
|
-
|
102
|
-
links.select do |link|
|
103
|
-
link["document_type"] == type
|
104
|
-
end
|
114
|
+
def related_taxons
|
115
|
+
content_item_links_for('taxons', only: 'taxon')
|
105
116
|
end
|
106
117
|
|
107
|
-
def
|
108
|
-
|
109
|
-
|
118
|
+
def related_topics
|
119
|
+
if related_legacy_topics.any?
|
120
|
+
related_legacy_topics
|
121
|
+
elsif related_taxons.any?
|
122
|
+
related_taxons
|
123
|
+
else
|
124
|
+
[]
|
125
|
+
end
|
110
126
|
end
|
111
127
|
|
112
|
-
def
|
113
|
-
|
128
|
+
def related_legacy_topics
|
129
|
+
mainstream_browse_page_links = content_item_links_for('mainstream_browse_pages', only: 'mainstream_browse_page')
|
130
|
+
topic_links = content_item_links_for('topics', only: 'topic')
|
114
131
|
|
115
|
-
|
116
|
-
|
132
|
+
mainstream_browse_page_links + topic_links.find_all do |topic_link|
|
133
|
+
mainstream_browse_page_links.none? do |mainstream_browse_page_link|
|
134
|
+
mainstream_browse_page_link[:text] == topic_link[:text]
|
135
|
+
end
|
117
136
|
end
|
118
|
-
|
119
|
-
links = build_links_for_sidebar(mainstream_browse_pages + topics_that_dont_duplicate_browse)
|
120
|
-
links.compact
|
121
137
|
end
|
122
138
|
|
123
139
|
def related_topical_events
|
124
|
-
|
125
|
-
build_links_for_sidebar(topical_events)
|
140
|
+
content_item_links_for('topical_events', only: 'topical_event')
|
126
141
|
end
|
127
142
|
|
128
143
|
def related_contacts
|
129
|
-
|
130
|
-
build_links_for_sidebar(contacts)
|
144
|
+
content_item_links_for('related', only: 'contact')
|
131
145
|
end
|
132
146
|
|
133
147
|
def related_external_links
|
134
|
-
|
135
|
-
build_links_for_sidebar(external_links, "url", rel: "external")
|
136
|
-
end
|
137
|
-
|
138
|
-
def parameterise(str, sep = "-")
|
139
|
-
parameterised_str = str.gsub(/[^\w\-]+/, sep)
|
140
|
-
unless sep.nil? || sep.empty?
|
141
|
-
re_sep = Regexp.escape(sep)
|
142
|
-
# No more than one of the separator in a row.
|
143
|
-
parameterised_str.gsub!(/#{re_sep}{2,}/, sep)
|
144
|
-
# Remove leading/trailing separator.
|
145
|
-
parameterised_str.gsub!(/^#{re_sep}|#{re_sep}$/, '')
|
146
|
-
end
|
147
|
-
parameterised_str.downcase
|
148
|
-
end
|
149
|
-
|
150
|
-
def related_links
|
151
|
-
link_group("ordered_related_items")
|
148
|
+
content_item_details_for('external_related_links')
|
152
149
|
end
|
153
150
|
|
154
151
|
def related_mainstream_content
|
155
|
-
return [] unless
|
152
|
+
return [] unless detailed_guide?
|
156
153
|
|
157
|
-
|
158
|
-
build_links_for_sidebar(content)
|
154
|
+
content_item_links_for('related_mainstream_content')
|
159
155
|
end
|
160
156
|
|
161
157
|
def related_guides
|
162
|
-
return [] unless
|
158
|
+
return [] unless detailed_guide?
|
163
159
|
|
164
|
-
|
165
|
-
build_links_for_sidebar(guides)
|
160
|
+
content_item_links_for('related_guides')
|
166
161
|
end
|
167
162
|
|
168
|
-
def
|
169
|
-
|
163
|
+
def related_document_collections
|
164
|
+
content_item_links_for('document_collections', only: 'document_collection')
|
165
|
+
end
|
166
|
+
|
167
|
+
def detailed_guide?
|
168
|
+
@content_item['document_type'] == 'detailed_guide'
|
169
|
+
end
|
170
|
+
|
171
|
+
def content_item_details_for(key)
|
172
|
+
Array(@content_item.dig('details', key))
|
173
|
+
.map { |link| { path: link['url'], text: link['title'], rel: 'external' } }
|
174
|
+
end
|
175
|
+
|
176
|
+
def content_item_links_for(key, only: nil)
|
177
|
+
links = Array(@content_item.dig('links', key))
|
178
|
+
|
179
|
+
if key == 'taxons'
|
180
|
+
links = links.find_all { |link| link['phase'] == 'live' }
|
181
|
+
end
|
182
|
+
|
183
|
+
if only.present?
|
184
|
+
links = links.find_all { |link| link['document_type'] == only }
|
185
|
+
end
|
186
|
+
|
187
|
+
links.map { |link| { path: link['base_path'], text: link['title'] } }
|
170
188
|
end
|
171
189
|
end
|
172
190
|
end
|
@@ -1,84 +1,15 @@
|
|
1
1
|
# Back link
|
2
2
|
|
3
|
-
##
|
3
|
+
## Installation
|
4
4
|
|
5
|
-
|
5
|
+
See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
|
6
6
|
|
7
|
-
## Guidance
|
7
|
+
## Guidance and Examples
|
8
8
|
|
9
9
|
Find out when to use the back link component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/back-link).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Back link
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/back-link/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<a href="#" class="govuk-back-link">Back</a>
|
20
|
-
|
21
|
-
#### Macro
|
22
|
-
|
23
|
-
{% from "back-link/macro.njk" import govukBackLink %}
|
24
|
-
|
25
|
-
{{ govukBackLink({
|
26
|
-
"href": "#"
|
27
|
-
}) }}
|
28
|
-
|
29
|
-
### Back link with custom text
|
30
|
-
|
31
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/back-link/with-custom-text/preview)
|
32
|
-
|
33
|
-
#### Markup
|
34
|
-
|
35
|
-
<a href="#" class="govuk-back-link">Back to home</a>
|
36
|
-
|
37
|
-
#### Macro
|
38
|
-
|
39
|
-
{% from "back-link/macro.njk" import govukBackLink %}
|
40
|
-
|
41
|
-
{{ govukBackLink({
|
42
|
-
"href": "#",
|
43
|
-
"text": "Back to home"
|
44
|
-
}) }}
|
45
|
-
|
46
|
-
## Requirements
|
47
|
-
|
48
|
-
### Build tool configuration
|
49
|
-
|
50
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
51
|
-
|
52
|
-
.pipe(sass({
|
53
|
-
includePaths: 'node_modules/'
|
54
|
-
}))
|
55
|
-
|
56
|
-
### Static asset path configuration
|
57
|
-
|
58
|
-
In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
|
59
|
-
|
60
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
61
|
-
|
62
11
|
## Component options
|
63
12
|
|
64
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
65
14
|
|
66
|
-
See [options table](https://design-system.service.gov.uk/components/back-link/#options-example-default) for details.
|
67
|
-
|
68
|
-
### Setting up Nunjucks views and paths
|
69
|
-
|
70
|
-
Below is an example setup using express configure views:
|
71
|
-
|
72
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
73
|
-
autoescape: true,
|
74
|
-
cache: false,
|
75
|
-
express: app
|
76
|
-
})
|
77
|
-
|
78
|
-
## Contribution
|
79
|
-
|
80
|
-
Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
|
81
|
-
|
82
|
-
## License
|
83
|
-
|
84
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/back-link/#options-example-default) for details.
|
@@ -1,249 +1,15 @@
|
|
1
1
|
# Breadcrumbs
|
2
2
|
|
3
|
-
##
|
3
|
+
## Installation
|
4
4
|
|
5
|
-
|
5
|
+
See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
|
6
6
|
|
7
|
-
## Guidance
|
7
|
+
## Guidance and Examples
|
8
8
|
|
9
9
|
Find out when to use the breadcrumbs component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/breadcrumbs).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Breadcrumbs
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/breadcrumbs/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<div class="govuk-breadcrumbs">
|
20
|
-
<ol class="govuk-breadcrumbs__list">
|
21
|
-
|
22
|
-
<li class="govuk-breadcrumbs__list-item">
|
23
|
-
<a class="govuk-breadcrumbs__link" href="/section">Section</a>
|
24
|
-
</li>
|
25
|
-
|
26
|
-
<li class="govuk-breadcrumbs__list-item">
|
27
|
-
<a class="govuk-breadcrumbs__link" href="/section/sub-section">Sub-section</a>
|
28
|
-
</li>
|
29
|
-
|
30
|
-
</ol>
|
31
|
-
</div>
|
32
|
-
|
33
|
-
#### Macro
|
34
|
-
|
35
|
-
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
|
36
|
-
|
37
|
-
{{ govukBreadcrumbs({
|
38
|
-
"items": [
|
39
|
-
{
|
40
|
-
"text": "Section",
|
41
|
-
"href": "/section"
|
42
|
-
},
|
43
|
-
{
|
44
|
-
"text": "Sub-section",
|
45
|
-
"href": "/section/sub-section"
|
46
|
-
}
|
47
|
-
]
|
48
|
-
}) }}
|
49
|
-
|
50
|
-
### Breadcrumbs with one level
|
51
|
-
|
52
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/breadcrumbs/with-one-level/preview)
|
53
|
-
|
54
|
-
#### Markup
|
55
|
-
|
56
|
-
<div class="govuk-breadcrumbs">
|
57
|
-
<ol class="govuk-breadcrumbs__list">
|
58
|
-
|
59
|
-
<li class="govuk-breadcrumbs__list-item">
|
60
|
-
<a class="govuk-breadcrumbs__link" href="/section">Section</a>
|
61
|
-
</li>
|
62
|
-
|
63
|
-
</ol>
|
64
|
-
</div>
|
65
|
-
|
66
|
-
#### Macro
|
67
|
-
|
68
|
-
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
|
69
|
-
|
70
|
-
{{ govukBreadcrumbs({
|
71
|
-
"items": [
|
72
|
-
{
|
73
|
-
"text": "Section",
|
74
|
-
"href": "/section"
|
75
|
-
}
|
76
|
-
]
|
77
|
-
}) }}
|
78
|
-
|
79
|
-
### Breadcrumbs with multiple levels
|
80
|
-
|
81
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/breadcrumbs/with-multiple-levels/preview)
|
82
|
-
|
83
|
-
#### Markup
|
84
|
-
|
85
|
-
<div class="govuk-breadcrumbs">
|
86
|
-
<ol class="govuk-breadcrumbs__list">
|
87
|
-
|
88
|
-
<li class="govuk-breadcrumbs__list-item">
|
89
|
-
<a class="govuk-breadcrumbs__link" href="/">Home</a>
|
90
|
-
</li>
|
91
|
-
|
92
|
-
<li class="govuk-breadcrumbs__list-item">
|
93
|
-
<a class="govuk-breadcrumbs__link" href="/section">Section</a>
|
94
|
-
</li>
|
95
|
-
|
96
|
-
<li class="govuk-breadcrumbs__list-item">
|
97
|
-
<a class="govuk-breadcrumbs__link" href="/section/sub-section">Sub-section</a>
|
98
|
-
</li>
|
99
|
-
|
100
|
-
<li class="govuk-breadcrumbs__list-item">
|
101
|
-
<a class="govuk-breadcrumbs__link" href="/section/sub-section/sub-sub-section">Sub Sub-section</a>
|
102
|
-
</li>
|
103
|
-
|
104
|
-
</ol>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
#### Macro
|
108
|
-
|
109
|
-
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
|
110
|
-
|
111
|
-
{{ govukBreadcrumbs({
|
112
|
-
"items": [
|
113
|
-
{
|
114
|
-
"text": "Home",
|
115
|
-
"href": "/"
|
116
|
-
},
|
117
|
-
{
|
118
|
-
"text": "Section",
|
119
|
-
"href": "/section"
|
120
|
-
},
|
121
|
-
{
|
122
|
-
"text": "Sub-section",
|
123
|
-
"href": "/section/sub-section"
|
124
|
-
},
|
125
|
-
{
|
126
|
-
"text": "Sub Sub-section",
|
127
|
-
"href": "/section/sub-section/sub-sub-section"
|
128
|
-
}
|
129
|
-
]
|
130
|
-
}) }}
|
131
|
-
|
132
|
-
### Breadcrumbs without the home section
|
133
|
-
|
134
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/breadcrumbs/without-the-home-section/preview)
|
135
|
-
|
136
|
-
#### Markup
|
137
|
-
|
138
|
-
<div class="govuk-breadcrumbs">
|
139
|
-
<ol class="govuk-breadcrumbs__list">
|
140
|
-
|
141
|
-
<li class="govuk-breadcrumbs__list-item">
|
142
|
-
<a class="govuk-breadcrumbs__link" href="/service-manual">Service Manual</a>
|
143
|
-
</li>
|
144
|
-
|
145
|
-
<li class="govuk-breadcrumbs__list-item">
|
146
|
-
<a class="govuk-breadcrumbs__link" href="/service-manual/agile-delivery">Agile Delivery</a>
|
147
|
-
</li>
|
148
|
-
|
149
|
-
</ol>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
#### Macro
|
153
|
-
|
154
|
-
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
|
155
|
-
|
156
|
-
{{ govukBreadcrumbs({
|
157
|
-
"items": [
|
158
|
-
{
|
159
|
-
"text": "Service Manual",
|
160
|
-
"href": "/service-manual"
|
161
|
-
},
|
162
|
-
{
|
163
|
-
"text": "Agile Delivery",
|
164
|
-
"href": "/service-manual/agile-delivery"
|
165
|
-
}
|
166
|
-
]
|
167
|
-
}) }}
|
168
|
-
|
169
|
-
### Breadcrumbs with last breadcrumb as current page
|
170
|
-
|
171
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/breadcrumbs/with-last-breadcrumb-as-current-page/preview)
|
172
|
-
|
173
|
-
#### Markup
|
174
|
-
|
175
|
-
<div class="govuk-breadcrumbs">
|
176
|
-
<ol class="govuk-breadcrumbs__list">
|
177
|
-
|
178
|
-
<li class="govuk-breadcrumbs__list-item">
|
179
|
-
<a class="govuk-breadcrumbs__link" href="/">Home</a>
|
180
|
-
</li>
|
181
|
-
|
182
|
-
<li class="govuk-breadcrumbs__list-item">
|
183
|
-
<a class="govuk-breadcrumbs__link" href="/browse/abroad">Passports, travel and living abroad</a>
|
184
|
-
</li>
|
185
|
-
|
186
|
-
<li class="govuk-breadcrumbs__list-item" aria-current="page">Travel abroad</li>
|
187
|
-
|
188
|
-
</ol>
|
189
|
-
</div>
|
190
|
-
|
191
|
-
#### Macro
|
192
|
-
|
193
|
-
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
|
194
|
-
|
195
|
-
{{ govukBreadcrumbs({
|
196
|
-
"items": [
|
197
|
-
{
|
198
|
-
"text": "Home",
|
199
|
-
"href": "/"
|
200
|
-
},
|
201
|
-
{
|
202
|
-
"text": "Passports, travel and living abroad",
|
203
|
-
"href": "/browse/abroad"
|
204
|
-
},
|
205
|
-
{
|
206
|
-
"text": "Travel abroad"
|
207
|
-
}
|
208
|
-
]
|
209
|
-
}) }}
|
210
|
-
|
211
|
-
## Requirements
|
212
|
-
|
213
|
-
### Build tool configuration
|
214
|
-
|
215
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
216
|
-
|
217
|
-
.pipe(sass({
|
218
|
-
includePaths: 'node_modules/'
|
219
|
-
}))
|
220
|
-
|
221
|
-
### Static asset path configuration
|
222
|
-
|
223
|
-
In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
|
224
|
-
|
225
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
226
|
-
|
227
11
|
## Component options
|
228
12
|
|
229
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
230
14
|
|
231
|
-
See [options table](https://design-system.service.gov.uk/components/breadcrumbs/#options-example-default) for details.
|
232
|
-
|
233
|
-
### Setting up Nunjucks views and paths
|
234
|
-
|
235
|
-
Below is an example setup using express configure views:
|
236
|
-
|
237
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
238
|
-
autoescape: true,
|
239
|
-
cache: false,
|
240
|
-
express: app
|
241
|
-
})
|
242
|
-
|
243
|
-
## Contribution
|
244
|
-
|
245
|
-
Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
|
246
|
-
|
247
|
-
## License
|
248
|
-
|
249
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/breadcrumbs/#options-example-default) for details.
|