Skip to content

Commit

Permalink
Use component wrapper on figure component
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Jan 17, 2025
1 parent 9fc5f71 commit ce45874
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions app/views/components/_figure.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<% add_app_component_stylesheet("figure") %>
<%
add_app_component_stylesheet("figure")
alt ||= ""
caption ||= ""
credit ||= ""
lang ||= "en"
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("app-c-figure")
component_helper.set_lang(lang)
%>
<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 %>
2 changes: 1 addition & 1 deletion app/views/components/docs/figure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ accessibility_criteria: |
The figure must:
- provide an informative text description, as alt text or caption
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit ce45874

Please sign in to comment.