freelawproject / bigcases2

The sequel to Big Cases Bot
Other
18 stars 11 forks source link

Experiment with django-components on bots.law #569

Open mlissner opened 3 months ago

mlissner commented 3 months ago

A problem we've had with bots.law and tailwind is that it's difficult to be consistent when we make things like buttons, headings, or other widgets that appear around the site. Tailwind uses a zillion classes, and it's hard to consistently apply them all.

On free.law, we solve that neatly using javascript components, which provide a lot of consistency and simplicity. Soon, we plan to re-do CourtListener using Tailwind instead of bootstrap, and so we'll want to move to components when we do that or else we won't have consistency across pages.

To fix all this, I did some research about how to do components in django. The best thing I found, short of moving to a large front-end framework, was django-components:

https://github.com/EmilStenstrom/django-components

And there's a really good article about using them with HTMX here:

https://www.pedaldrivenprogramming.com/2024/01/django-htmx-and-components/

This issue is to do a little experimentation with this. A few things to figure out:

  1. How do we integrate django-components into the project?

  2. What's a small component that we can move to django-components?

  3. What does it look like to do so?

  4. Where do we draw the line between "that's just HTML we put in that page" vs. "that deserves an item in the component library"?

And so forth. I think we should use bots.law to get good at this, and then move our lessons over to CourtListener during its redesign.