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

BREAKING Add component wrapper helper to the search component #4540

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

AshGDS
Copy link
Contributor

@AshGDS AshGDS commented Jan 10, 2025

What

Why

As the trello card states:

Standardising our components to use the component wrapper helper will reduce code, increase standardisation, and improve future feature implementation speed.

Visual changes

A new example has been added.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 10, 2025 15:14 Inactive
@AshGDS AshGDS changed the title BREAKING: Use component wrapper on search component **BREAKING** Add component wrapper helper to the search component Jan 10, 2025
@AshGDS AshGDS changed the title **BREAKING** Add component wrapper helper to the search component BREAKING Add component wrapper helper to the search component Jan 10, 2025
@AshGDS AshGDS force-pushed the search-component-wrapper branch from 309aeb0 to 5adedb3 Compare January 10, 2025 15:22
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 10, 2025 15:22 Inactive
@AshGDS AshGDS force-pushed the search-component-wrapper branch from 5adedb3 to af1151c Compare January 10, 2025 15:34
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 10, 2025 15:35 Inactive
@AshGDS AshGDS marked this pull request as ready for review January 10, 2025 15:44
@AshGDS AshGDS requested a review from andysellick January 10, 2025 15:44
if local_assigns[:on_govuk_blue].eql?(true)
classes << "gem-c-search--on-govuk-blue"
component_helper.add_class("gem-c-search--on-govuk-blue")
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking: you could probably rewrite this bit as follows, but it might be clearer as-is. I'll leave it to you.

component_helper.add_class("gem-c-search--on-govuk-blue") if local_assigns[:on_govuk_blue].eql?(true)
component_helper.add_class("gem-c-search--on-white") unless local_assigns[:on_govuk_blue].eql?(true)

end
classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
component_helper.add_class("gem-c-search--separate-label") if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I'd move this line up to join the rest of the add_class lines, above.

@@ -100,7 +100,7 @@ def component_name
it "applies data attributes when provided" do
render_component(
button_text: "Some test text",
data_attributes: {
button_data_attributes: {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're certain that these button attributes aren't set anywhere, I think it'd be a good opportunity to remove this option. I'd double check it's not being picked up in any JS anywhere.

@AshGDS AshGDS force-pushed the search-component-wrapper branch from af1151c to 83fbd94 Compare January 13, 2025 09:37
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 13, 2025 09:38 Inactive
@AshGDS AshGDS force-pushed the search-component-wrapper branch from 83fbd94 to 0a2dd94 Compare January 13, 2025 09:40
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 13, 2025 09:40 Inactive
Breaking as it:
- Renames the `id` option to `label_id`
- Renames `data_attributes` to `button_data_attributes`
@AshGDS AshGDS force-pushed the search-component-wrapper branch from 0a2dd94 to fa5ccd3 Compare January 13, 2025 09:43
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4540 January 13, 2025 09:43 Inactive
@AshGDS AshGDS merged commit 2f86e97 into main Jan 13, 2025
12 checks passed
@AshGDS AshGDS deleted the search-component-wrapper branch January 13, 2025 09:49
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