govuk_publishing_components 44.6.0 → 44.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82f64e3191afbeb2850a910360ef1d52d51d4c20e3da6af8c876b95e5118f267
4
- data.tar.gz: 4611f6340457666face57e7ae9b0625c7b30c8432b881c88db7d474f41191c32
3
+ metadata.gz: e5ba6725a25a3a6f4deab7d12f966fd45deffec95db3338046356ac8839c9786
4
+ data.tar.gz: 3a5eca27892ddcc8625dd2a0873a16105568c171f22a5528be8dd264387fccf1
5
5
  SHA512:
6
- metadata.gz: 6c183fbef201a31897b2394602aa1eff29773cd15ee22730da0e4232300ca9b13ae391c430852d7679a4979132f0ca9f510647526235a58f1b142693b940f593
7
- data.tar.gz: f975cd4193f22ccdd364f4a77a4dbf0429ebc2b87d2c273f9e6b973e524f5150a28caa8454b8c2a4512e0079abebd002d2460738c002d3c459eb297d16fd6421
6
+ metadata.gz: 6c0beb2ff0859c3c88636426aa3d29fedc2523f84db0c571eae2d1d839876dcaa1e914da7772281aa3d9e282f8b7163da22d09dba2a326509c142af928932ee3
7
+ data.tar.gz: 9b39a514c5b1083adf3009e8d551d574733a74a9845a63d384966334abbc2007589c9a8b29d8ba1aa0df6600acc5b8a54e2b1dfe9295dd09c23d726670495fd5
@@ -5,7 +5,6 @@
5
5
  // Always render the contents list above a
6
6
  // back to contents link
7
7
  position: relative;
8
- margin: 0 0 govuk-spacing(4) 0;
9
8
  z-index: 1;
10
9
  background: govuk-colour("white");
11
10
  box-shadow: 0 20px 15px -10px govuk-colour("white");
@@ -1,15 +1,18 @@
1
- <%-
1
+ <%
2
2
  add_gem_component_stylesheet("contents-list")
3
3
 
4
- cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns)
5
4
  underline_links ||= false
6
5
  format_numbers ||= false
7
6
  alternative_line_style ||= false
8
7
  title ||= nil
9
8
  brand ||= false
9
+ local_assigns[:aria] ||= {}
10
+ local_assigns[:margin_bottom] ||= 4
11
+
12
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
13
+ cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns)
10
14
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
11
- title_fallback = t("components.contents_list.contents", locale: I18n.locale, fallback: false, default: "en")
12
- classes = %w[gem-c-contents-list]
15
+
13
16
  link_classes = %w[gem-c-contents-list__link govuk-link gem-print-link]
14
17
  link_classes << brand_helper.color_class
15
18
  link_classes << "govuk-link--no-underline" unless underline_links
@@ -21,15 +24,18 @@
21
24
  type: "contents list",
22
25
  index_total: cl_helper.get_index_total,
23
26
  } unless disable_ga4
24
- local_assigns[:aria] ||= {}
27
+
25
28
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
26
29
  component_helper.add_class("gem-c-contents-list #{brand_helper.brand_class}")
27
30
  component_helper.add_class("gem-c-contents-list--alternative-line-style") if alternative_line_style
28
31
  component_helper.add_class("gem-c-contents-list--custom-title") if title
32
+ component_helper.add_class(shared_helper.get_margin_bottom)
29
33
  component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
30
34
  component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
31
35
  component_helper.add_role("navigation")
32
- -%>
36
+
37
+ title_fallback = t("components.contents_list.contents", locale: I18n.locale, fallback: false, default: "en")
38
+ %>
33
39
  <% if cl_helper.contents.any? %>
34
40
  <%= tag.nav(**component_helper.all_attributes) do %>
35
41
  <%= content_tag(
@@ -1,12 +1,11 @@
1
1
  name: Contents list
2
2
  description: Provides a list of links with options for dashes or numbering.
3
3
  body: |
4
- Commonly used to lists a page’s contents with links pointing to headings within the document, but can also be used for a list of links to other pages.
4
+ Commonly used to list the contents of a page with links pointing to headings within the document, but can also be used for a list of links to other pages.
5
5
 
6
6
  Pass a list of contents each with an `href` and `text`. The `href` can point at the ID of a heading within the page.
7
7
 
8
- Supports nesting contents one level deep, currently only used by specialist documents. When nesting the top level list items
9
- display in bold.
8
+ Supports nesting contents one level deep, currently only used by specialist documents. When nesting the top level list items display in bold.
10
9
 
11
10
  `format_numbers` option will pull out numbers in the link text to render them as though they were the list style type. Applies to numbers at the start of text, with or without a decimal. See the [format complex numbers fixture](/component-guide/contents-list/formats_complex_numbers) for details.
12
11
  accessibility_criteria: |
@@ -36,6 +35,17 @@ examples:
36
35
  text: Second thing
37
36
  - href: "#third-thing"
38
37
  text: Third thing
38
+ with_bottom_margin:
39
+ description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). The default margin bottom is `20px` (`govuk-spacing(4)`).
40
+ data:
41
+ margin_bottom: 9
42
+ contents:
43
+ - href: "#first-thing"
44
+ text: First thing
45
+ - href: "#second-thing"
46
+ text: Second thing
47
+ - href: "#third-thing"
48
+ text: Third thing
39
49
  underline_links:
40
50
  description: By default we do not underline links in this component even though this is the general approach on GOV.UK. This is because some of the examples below (particularly those with numbers) do not work well with underlined links. Instead, this option allows the links to be underlined where appropriate.
41
51
  data:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "44.6.0".freeze
2
+ VERSION = "44.7.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 44.6.0
4
+ version: 44.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick