feat: introducing custom_search_form slot in the header component#4024
Open
marianayovcheva wants to merge 1 commit into
Open
feat: introducing custom_search_form slot in the header component#4024marianayovcheva wants to merge 1 commit into
marianayovcheva wants to merge 1 commit into
Conversation
# Conflicts: # CHANGELOG.md
e80d0c5 to
371b2f9
Compare
Contributor
|
🚀 Netlify deployed citizens-advice-design-system as draft https://69b9740175d69f591eb3570a--citizens-advice-design-system.netlify.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am working on introducing a search autocomplete field in the header. The autocomplete is a product related change and even if at some point we decide to introduce it in the design system it might be a while until we do so. In the product I wanted to change what we pass to the
HeaderSearchslot of theHeadercomponent. The problem is that I then had to copy the whole html.erb file.To make the header more flexible to such changes, this PR adds a
custom_search_formslot to the header. But my main question is does this allow too much freedom to what can be added to the component.Other approaches I've thought about while working on the change:
HeaderSearchForminto its own component - this way it would have this would solve most of problems. The reason I didn't go for it was because I wasn't sure if it's generally okay to have a sub component and I didn't know if we'd need to make a separate page on the docs site for itcallblock in theHeaderSearchblock where the user could optionally add content (similar to theAccountLinkslot). The problem with this is that unlike the other slots that use the logic, we have a fair bit of html to transfer and it felt wrong to bring it in the component file and not the template one.As an aside, was also tempted to just use the
CitizensAdviceComponents::Searchinstead of the form with input and button, but realised that the way that the classes are passed is different and there is also a search icon, but I guess it's a candidate for making our search inputs more consistent.