Skip to content

Commit

Permalink
Add component wrapper helper to back to top component
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Mar 4, 2025
1 parent 71c01b8 commit c16cbf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<%
add_gem_component_stylesheet("back-to-top")
text ||= t('content_item.contents', default: "Contents")
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("govuk-link gem-c-back-to-top govuk-!-display-none-print")
%>
<a class="govuk-link gem-c-back-to-top govuk-!-display-none-print"
href="<%= href %>">


<%= link_to href, **component_helper.all_attributes do %>
<svg class="gem-c-back-to-top__icon" xmlns="http://www.w3.org/2000/svg" width="13" height="17" viewBox="0 0 13 17" aria-hidden="true" focusable="false">
<path fill="currentColor" d="M6.5 0L0 6.5 1.4 8l4-4v12.7h2V4l4.3 4L13 6.4z"/>
</svg>
<%= text %>
</a>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Back to top link
description: An anchor link intended to allow users to return to the top of the content.
shared_accessibility_criteria:
- link
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit c16cbf8

Please sign in to comment.