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

Remove use of shared helper for margin #3611

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions app/views/components/_expander.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
3 changes: 0 additions & 3 deletions app/views/components/_filter_panel.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
<div class="app-c-filter-panel__header">
<%= tag.button(
Expand Down
2 changes: 0 additions & 2 deletions app/views/components/_filter_section.html.erb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions app/views/components/_filter_summary.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>

Expand Down
8 changes: 1 addition & 7 deletions app/views/components/docs/expander.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
9 changes: 0 additions & 9 deletions app/views/components/docs/filter_panel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,3 @@ examples:
]
} %>
</div>
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
Loading