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

Use component wrapper in hint component #4214

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Use component wrapper in hint component #4214

merged 1 commit into from
Sep 10, 2024

Conversation

kevindew
Copy link
Member

@kevindew kevindew commented Sep 9, 2024

What

This adds the component wrapper to the hint component in order to provide additional options to a hint.

Why

The primary motivation of this was that we want to dynamically change the value of a hint in GOV.UK Chat and thus want to set a .js-class to act as a selector 1 (private repo) and instead are using a custom id to work around it.

Looking at other components it seemed that using the component wrapper was a more conventional approach than just utilising the shared helper to add only classes.

Visual Changes

None

@@ -25,3 +26,9 @@ examples:
data:
text: "العربيَّة"
right_to_left: true
with_js_class:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're very welcome to add an explicit documentation of this feature, but just to let you know that the options for the component wrapper are automatically added to the top of this guide page when uses_component_wrapper_helper is included.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good shout. I'll remove it. I added a test for it already so there's something to stop a regression.

This adds the component wrapper to the hint component in order to
provide additional options to a hint.

The primary motivation of this was that we want to dynamically change
the value of a hint in GOV.UK Chat and thus want to set a .js-class to
act as a selector [1] (private repo) and instead are using a custom id
to work around it.

Looking at other components it seemed that using the component wrapper
was a more conventional approach than just utilising the shared helper
to add only classes.

[1]: alphagov/govuk-chat#660 (comment)
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4214 September 10, 2024 08:50 Inactive
@kevindew kevindew merged commit 99dfc72 into main Sep 10, 2024
12 checks passed
@kevindew kevindew deleted the hint-extra-options branch September 10, 2024 08:53
@matthillco matthillco mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants