-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
309aeb0
to
5adedb3
Compare
5adedb3
to
af1151c
Compare
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") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
spec/components/search_spec.rb
Outdated
@@ -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: { |
There was a problem hiding this comment.
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.
af1151c
to
83fbd94
Compare
83fbd94
to
0a2dd94
Compare
Breaking as it: - Renames the `id` option to `label_id` - Renames `data_attributes` to `button_data_attributes`
0a2dd94
to
fa5ccd3
Compare
What
search
component.id
option tolabel_id
data_attributes
tobutton_data_attributes
- though this is not used anywhere on GOV.UK (should it removed? I think it was needed for when Universal Analytics was on GOV.UK.)Why
As the trello card states:
Visual changes
A new example has been added.