Skip to content

Commit

Permalink
Merge pull request #3532 from alphagov/add-component-wrapper-to-more-…
Browse files Browse the repository at this point in the history
…components

Use component wrapper on figure component
  • Loading branch information
AshGDS authored Jan 23, 2025
2 parents 7c99e74 + b493bb6 commit 1503b29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/views/components/_figure.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
alt ||= ''
caption ||= ''
credit ||= ''
local_assigns[:lang] ||= "en"

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("app-c-figure")
%>
<figure class="app-c-figure" lang="en">
<%= tag.figure(**component_helper.all_attributes) do %>
<% if src.present? %>
<img class="app-c-figure__image" src="<%= src %>" alt="<%= alt %>">
<% end %>
Expand All @@ -22,4 +26,4 @@
<% end %>
</figcaption>
<% end %>
</figure>
<% end %>
1 change: 1 addition & 0 deletions app/views/components/docs/figure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ accessibility_criteria: |
- provide an informative text description, as alt text or caption
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit 1503b29

Please sign in to comment.