You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2021. It is now read-only.
I know it's not a widely used component, but I thought I'd still share my roadmap for Picky.
One thing that gets asked a lot is "can Picky do X", I'm usually surprised to find that with a combination of render props and some other hacks, that yes, Picky can do it.
However, as more feature requests come in and for those cases where a render prop won't cut it, I find myself adding prop after prop. There are currently 34 props that can get passed to Picky. The API isn't fun or flexible to work with, so I'm proposing a new structure to Picky.
If you want a filter, just add the component. If you want to build your own component, use the PickyContext.
// Very contrived examplefunctionSomeOtherFilter({ className, ...rest}: Props){const{ onFilterOptions }=usePicky();// Exported along with the library. functiononChange(e: React.ChangeEvent<HTMLInputElement>){// Send it to analyticsAnalytics.send('user:filter',e.target.value);onFilterOptions(e.target.value.trim());}return(<inputclassName="picky__filter"type="text"onChange={onChange}{...rest}/>);}
The filter can be outside of the dropdown and live inside the button instead of a placeholder. Select all can be a button outside the dropdown. Render what you want and use the context to get the options and selected values.
Here's an example creating a multi column dropdown list, yes you could do this with plain CSS, I'm just showing an example where you can use the context:
Since I was able to re-think Picky from the ground up, the code is simpler and much shorter.
Current Picky is around 1656 lines of code. Whereas the new version is around 330 lines of code. This drops the bundle size too:
Sizes (Minified)
Old: 12.6 KB (4.1KB gz)
New: 3.65KB (1.44KB gz)
I'm still playing around with the concept, but it's looking extremely promising.
The text was updated successfully, but these errors were encountered:
Hi @donkeyDau sorry, no estimate at the moment I'm afraid. Work and personal life have been taking my attention this year and it has been hard to commit to this.
I might be able to get to it over the holidays when I have some personal time.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I know it's not a widely used component, but I thought I'd still share my roadmap for Picky.
One thing that gets asked a lot is "can Picky do X", I'm usually surprised to find that with a combination of render props and some other hacks, that yes, Picky can do it.
However, as more feature requests come in and for those cases where a render prop won't cut it, I find myself adding prop after prop. There are currently 34 props that can get passed to Picky. The API isn't fun or flexible to work with, so I'm proposing a new structure to Picky.
If you want a filter, just add the component. If you want to build your own component, use the PickyContext.
The filter can be outside of the dropdown and live inside the button instead of a placeholder. Select all can be a button outside the dropdown. Render what you want and use the context to get the options and selected values.
Here's an example creating a multi column dropdown list, yes you could do this with plain CSS, I'm just showing an example where you can use the context:
Since I was able to re-think Picky from the ground up, the code is simpler and much shorter.
Current Picky is around 1656 lines of code. Whereas the new version is around 330 lines of code. This drops the bundle size too:
Sizes (Minified)
Old: 12.6 KB (4.1KB gz)
New: 3.65KB (1.44KB gz)
I'm still playing around with the concept, but it's looking extremely promising.
The text was updated successfully, but these errors were encountered: