From 8900957e6ad77a0848ef30595f7b9a8f3c6523e0 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Tue, 17 Dec 2024 16:08:02 +0000 Subject: [PATCH] Remove shared helper for margin - removes the shared helper call to set margin, as this is now handled by the component wrapper helper, which all of these components already use - one of these didn't seem to be using the shared helper at all --- app/views/components/_expander.html.erb | 3 --- app/views/components/_filter_panel.html.erb | 3 --- app/views/components/_filter_section.html.erb | 2 -- app/views/components/_filter_summary.html.erb | 3 --- app/views/components/docs/expander.yml | 8 +------- app/views/components/docs/filter_panel.yml | 9 --------- 6 files changed, 1 insertion(+), 27 deletions(-) diff --git a/app/views/components/_expander.html.erb b/app/views/components/_expander.html.erb index 1ea33aa8f..cbe3fb636 100644 --- a/app/views/components/_expander.html.erb +++ b/app/views/components/_expander.html.erb @@ -2,16 +2,13 @@ <% title ||= false open_on_load ||= false - margin_bottom ||= 0 content_id = "expander-content-#{SecureRandom.hex(4)}" - shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) component_helper.add_data_attribute({ module: "expander" }) component_helper.add_data_attribute({ "open-on-load": open_on_load }) component_helper.add_class("app-c-expander") - component_helper.add_class(shared_helper.get_margin_bottom) unless margin_bottom == 0 component_helper.add_data_attribute({ "button-data-attributes": button_data_attributes }) if local_assigns.include?(:button_data_attributes) %> <% if title %> diff --git a/app/views/components/_filter_panel.html.erb b/app/views/components/_filter_panel.html.erb index ede15bd73..09ea0eec0 100644 --- a/app/views/components/_filter_panel.html.erb +++ b/app/views/components/_filter_panel.html.erb @@ -13,12 +13,9 @@ raise ArgumentError, "reset_link_href is required" if show_reset_link && !local_assigns[:reset_link_href] component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) - shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) component_helper.add_data_attribute({ module: "filter-panel ga4-event-tracker" }) component_helper.add_class("app-c-filter-panel") - component_helper.add_class(shared_helper.get_margin_bottom) if local_assigns[:margin_bottom] %> - <%= tag.div(**component_helper.all_attributes) do %>
<%= tag.button( diff --git a/app/views/components/_filter_section.html.erb b/app/views/components/_filter_section.html.erb index 2eeaf73be..1e64e203f 100644 --- a/app/views/components/_filter_section.html.erb +++ b/app/views/components/_filter_section.html.erb @@ -1,7 +1,6 @@ <% add_app_component_stylesheet("filter-section") %> <% raise ArgumentError, "heading_text is required" unless local_assigns[:heading_text] - shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) open ||= nil status_text ||= "" heading_level ||= 2 @@ -19,7 +18,6 @@ component_helper.add_class("app-c-filter-section") component_helper.set_open(open) %> - <%= tag.details(**component_helper.all_attributes) do %> <%= tag.summary( class: "app-c-filter-section__summary", diff --git a/app/views/components/_filter_summary.html.erb b/app/views/components/_filter_summary.html.erb index b85b1a542..9a755de43 100644 --- a/app/views/components/_filter_summary.html.erb +++ b/app/views/components/_filter_summary.html.erb @@ -9,13 +9,10 @@ reset_link_href ||= nil reset_link_text ||= "Clear all filters" - shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) - component_helper.add_class(shared_helper.get_margin_bottom) if local_assigns[:margin_bottom] component_helper.add_data_attribute({ module: "ga4-event-tracker" }) component_helper.add_class("app-c-filter-summary") %> - <%= tag.div(**component_helper.all_attributes) do %> <%= content_tag("h#{heading_level}", heading_text, class: "app-c-filter-summary__heading") %> diff --git a/app/views/components/docs/expander.yml b/app/views/components/docs/expander.yml index c37ed77a1..57da54054 100644 --- a/app/views/components/docs/expander.yml +++ b/app/views/components/docs/expander.yml @@ -8,6 +8,7 @@ accessibility_criteria: | - indicate where the state of expandable content has changed - be operable with a keyboard - be expanded by default without Javascript enabled +uses_component_wrapper_helper: true examples: default: data: @@ -21,13 +22,6 @@ examples: open_on_load: true block: | This is some content that is passed to the component. It should be distinct from the component, in that the component should not style or interact with it, other than to show and hide it. - with_margin_bottom: - description: The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](http://govuk-frontend-review.herokuapp.com/docs/#settings/spacing-variable-govuk-spacing-points). It defaults to a margin bottom of 0. - data: - title: Person - margin_bottom: 9 - block: | - This is some content that is passed to the component. It should be distinct from the component, in that the component should not style or interact with it, other than to show and hide it. with_counter: description: If there are form elements within the expander it can display a count of the number of form elements with a selected or input value. This is to make it appear the same as the option select component when appearing with it in search pages. Note that if any form elements are selected on page load, the component will expand by default. data: diff --git a/app/views/components/docs/filter_panel.yml b/app/views/components/docs/filter_panel.yml index 25902cdab..dbd00df0c 100644 --- a/app/views/components/docs/filter_panel.yml +++ b/app/views/components/docs/filter_panel.yml @@ -98,12 +98,3 @@ examples: ] } %>
- with_margin_bottom: - description: | - Allows the spacing at the bottom of the component to be adjusted. - - This accepts a number 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). It defaults to having no margin bottom. - data: - result_text: 1 partridge in a pear tree - button_text: Loooooads of space - margin_bottom: 9