Closed samouss closed 3 years ago
It totally makes sense. So would this replace entirely the need for BaseWidget?
Internally or externally? Because we still have to extends from it internally to have access to the InstantSearch instance.
I meant externally. I was thinking not advertising its usage at all. Reading the documentation I think maybe it's still the answer to some complex use cases (eg. overriding a refine method)
nevermind. Sounds good. I'll list here the components that need it then start this.
Yep indeed for use case where we don't have a widget implemented but the connector exist (e.g. connectAutocomplete). But even with those cases we can reduce the boilerplate code to extend this class. There are some abstractions that leak a bit: like the BEM root element or even the fact that the user have to manually call the connector. We can even think of another solution than the BaseWidget
class, not sure it's the best "Angular" way.
- those that are already done are checked
- those that are not relevant have been crossed out.
Right now the current process to customise a component is a bit cumbersome. We can leverage some Angular feature to have the same kind of API that we have with Vue InstantSearch (with slots). Here is a trivial example with a Toggle component (see below). With this API we don't have to manually create a component with the connector, etc... We can directly override the output from the template, it's very similar to the slots in Vue and render props in React.
Disclaimer: not sure that it's the "standard" way to let the user have the full control on the render.
Implementation:
Usage:
Here is the live example on CodeSandbox.