Skip to content

Commit

Permalink
Use component wrapper on result section component
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Jan 24, 2025
1 parent e4828bf commit 9d884a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/views/components/_result_sections.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
if !topics.any?
raise ArgumentError, "The result section component requires topics data"
end

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("app-c-result-sections")
%>
<div class="app-c-result-sections">
<%= tag.div(**component_helper.all_attributes) do %>
<% topics.each do |topic, results| %>
<section class="app-c-result-sections__section">
<h3 class="govuk-heading-m"><%= topic %></h3>
Expand All @@ -22,4 +25,4 @@
<% end %>
</section>
<% end %>
</div>
<% end %>
1 change: 1 addition & 0 deletions app/views/components/docs/result_sections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Result section
description: Groups a set of results items under a common title
shared_accessibility_criteria:
- link
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit 9d884a9

Please sign in to comment.