torchbox / django-pattern-library

UI pattern libraries for Django templates
https://torchbox.github.io/django-pattern-library/
BSD 3-Clause "New" or "Revised" License
360 stars 44 forks source link

Add ability to override resize sizes #227

Open jkevingutierrez opened 1 year ago

jkevingutierrez commented 1 year ago

Is your proposal related to a problem?

Right now the sizes used for different breakpoints (S, M and L) are fixed values. They are defined in https://github.com/torchbox/django-pattern-library/blob/main/pattern_library/templates/pattern_library/index.html#L16. Not all projects uses the same breakpoints. There are some scenarios where having other values would make more sense to review the components

Describe the solution you'd like

Add the ability to override the values defined in https://github.com/torchbox/django-pattern-library/blob/main/pattern_library/templates/pattern_library/index.html#L16. Those can be the default values, but it would be great to have a settings variable that could allow us to override those values

kmtracey commented 1 year ago

It's possible to override these values by overriding this entire template (https://docs.djangoproject.com/en/4.2/howto/overriding-templates/) which I have done in a project. If more settings aren't wanted for the pattern library it might be nice to put the resize buttons in a block which could extend/override (https://docs.djangoproject.com/en/4.2/howto/overriding-templates/#extending-an-overridden-template) just that one block.

thibaudcolas commented 1 year ago

I like the idea 👍 a setting seems sensible to me. Something like:

PATTERN_LIBRARY = {
    "VIEWPORTS": {
        "S": { "width": 320 },
        "M": { "width": 640 },
    },
}