Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add component wrapper to contextual guidance component #4277

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Update accessibility criteria in component docs ([PR #4242](https://github.com/alphagov/govuk_publishing_components/pull/4242))
* Show all big_number symbol types in our docs ([PR #4271](https://github.com/alphagov/govuk_publishing_components/pull/4271))
* Remove incorrect search component example ([PR #4253](https://github.com/alphagov/govuk_publishing_components/pull/4253))
* Add component wrapper to contextual guidance component ([PR #4282](https://github.com/alphagov/govuk_publishing_components/pull/4277))

## 43.5.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
id ||= nil
title ||= nil
content ||= nil
data_attributes ||= {}
data_attributes[:module] = "contextual-guidance"
guidance_id ||= nil

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.set_id(id)
component_helper.add_class("gem-c-contextual-guidance")
component_helper.add_data_attribute({ module: "contextual-guidance" })

%>

<%= tag.div class: "gem-c-contextual-guidance", id: id, data: data_attributes do %>
<%= tag.div(**component_helper.all_attributes) do %>
<%= tag.div class: "govuk-grid-row" do %>
<%= tag.div class: "govuk-grid-column-two-thirds" do %>
<%= tag.div class: "gem-c-contextual-guidance__input-field" do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ accessibility_criteria: |
* be hidden by default
* be visible when the associated input field if focused
* stay visible until another input field with guidance is being focused
uses_component_wrapper_helper: true
shared_accessibility_criteria:
- link
examples:
Expand Down
Loading