From 4b90b5988a6eb406364a814b2143a5678f3ab361 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:43:19 +0000 Subject: [PATCH] Use component wrapper on summary card component --- CHANGELOG.md | 1 + .../components/_summary_card.html.erb | 6 ++++-- .../components/docs/summary_card.yml | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93192cef19..32ebe95cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Use component wrapper on subscription links ([PR #4525](https://github.com/alphagov/govuk_publishing_components/pull/4525)) * Use component wrapper on success alert component ([PR #4527](https://github.com/alphagov/govuk_publishing_components/pull/4527)) +* Use component wrapper on summary card component ([PR #4528](https://github.com/alphagov/govuk_publishing_components/pull/4528)) ## 47.0.0 diff --git a/app/views/govuk_publishing_components/components/_summary_card.html.erb b/app/views/govuk_publishing_components/components/_summary_card.html.erb index 5eca00fbb8..ea06ef9a31 100644 --- a/app/views/govuk_publishing_components/components/_summary_card.html.erb +++ b/app/views/govuk_publishing_components/components/_summary_card.html.erb @@ -3,12 +3,14 @@ id ||= nil title ||= nil - data_attributes ||= {} summary_card_actions ||= [] rows ||=[] + + component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) + component_helper.add_class("gem-c-summary-card") %> <% if title || rows.any? %> - <%= tag.div class: "gem-c-summary-card", id: id, data: data_attributes do %> + <%= tag.div(**component_helper.all_attributes) do %> <%= tag.div class: "govuk-summary-card" do %> <%= tag.div class: "govuk-summary-card__title-wrapper" do %> <%= tag.h2 class: "govuk-summary-card__title" do %> diff --git a/app/views/govuk_publishing_components/components/docs/summary_card.yml b/app/views/govuk_publishing_components/components/docs/summary_card.yml index ea59711c8d..d618be9842 100644 --- a/app/views/govuk_publishing_components/components/docs/summary_card.yml +++ b/app/views/govuk_publishing_components/components/docs/summary_card.yml @@ -5,6 +5,7 @@ accessibility_criteria: | - be focusable with a keyboard - be usable with a keyboard - indicate when it has focus +uses_component_wrapper_helper: true examples: default: data: