django-pattern-library icon indicating copy to clipboard operation
django-pattern-library copied to clipboard

Add ability to override resize sizes

Open jkevingutierrez opened this issue 2 years ago • 2 comments

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

jkevingutierrez avatar Jul 07 '23 07:07 jkevingutierrez

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.

kmtracey avatar Jul 18 '23 15:07 kmtracey

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

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

thibaudcolas avatar Aug 19 '23 07:08 thibaudcolas