CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.22k stars 97 forks source link

Sort ModularUI FilterPills #626

Open ColeDCrawford opened 1 month ago

ColeDCrawford commented 1 month ago

FilterPills can take an ordering array. How would one sort those based on the filter count, so the most used items appear at the top?

Is there a way to customize the display of the pills, for example making them into a more standard dropdown list?

bglw commented 1 month ago

No trivial way to do the former, nothing exists in that component for the latter. But the goal of the Modular UI is that new cases can be addressed by creating new modules, rather than adding to existing modules.

Copying the filterPills.js file and making some tweaks would be the best step (until more "official" modules are added). Then your own class can be passed to the instance.add function of the Modular UI.

bglw commented 1 month ago

(I'll look at adding an option for that sorting next time I'm in the file though, that's a good call)