The discussion revolves around creating a custom search bar similar to the Search Banner Theme Component. pkundr wants to mirror the functionality of the default search bar to a custom <input type="text" /> element without using the existing theme component or plugin.
osioke suggests inspecting the code with a browser to determine the placement of the theme component and adjusting it accordingly. merefield recommends modifying the CSS to resolve appearance issues, while pkundr mentions that it’s not just a CSS issue, but also a matter of placement and HTML structure.
merefield provides an alternative solution using the Header Search Theme and suggests getting familiar with widget code if neither solution works.
I have been trying to build a custom search bar similar to the discourse-search-banner plugin. I don’t want to use that plugin as it interferes with the appearance of my theme.
How can I mirror that functionality to a <input type="text" /> of my choice?
I was looking at the source code of the plugin and tried to adapt it to just use my html element but was unable to figure it out. Any tips would be appreciated!
No worries, but that is a theme-component and not a plugin, so it changes a few things. Especially because theme-components work with client-side logic and plugins server-side logic. Or are you looking to make a plugin based of that theme-component?
I don’t really care whether it ends up being a plugin or a theme component as long as I achieve the desired functionality. Basically what I need is to mirror the behavior of the default search (icon in top bar) to a text-input of my choice.
It’s not really the CSS, more the placement and how it fits my HTML structure. If I can figure out how to modify where the component gets injected, I might have a solution. Can you point me in a direction?
With the theme component enabled on your site, inspect the code with your browser and see where it is placed. Adjust there in your browser to find somewhere more comfortable, and use that to update/edit a fork of the TC. That should work.