Repository navigation
feat(modal): add "full" size option - #524
Conversation
The modal width was capped at three fixed sizes (small/medium/large), with no option to use the full available page width. Nothing in the DSFR itself prevents a fr-col-lg-12 modal, and there are legitimate use cases (e.g. previewing a document before upload) where a full-width modal makes sense. Add a "full" value to the size prop, mapped to fr-col-12 fr-col-md-12 fr-col-lg-12, alongside the existing sizes. Closes codegouvfr#513
|
Thanks for the contribution! The code looks good to me, but react-dsfr aims to be a React implementation of the DSFR design system, and as far as I know, this option is not supported by the DSFR itself. Am I missing something? |
Hello @ddecrulle no you're right, the DSFR doesn't offer this option. But it also doesn't forbid you to do so. Although I can customize the HTML in the DSFR, here in React I have to rewrite a whole new component and with it a new My guess is that it conflicts with some UX rule stating that modals shouldn't be too wide and I respect that. Maybe a drawer component would be my best fit, but while waiting, I was hoping to tolerate this behaviour here. What do you think ? |
|
There is another solution using |
Closes #513
What
Adds a
"full"value toModal'ssizeprop, alongside the existing"small" | "medium" | "large", mapped tofr-col-12 fr-col-md-12 fr-col-lg-12.Why
As raised in #513, the modal width is currently capped at three fixed sizes. Nothing in the DSFR prevents a
fr-col-lg-12modal, and there are legitimate use cases (e.g. previewing a document before upload, with extra context fields) where a full-width modal is the right call.Changes
src/Modal/Modal.tsx: add"full"to thesizeunion type and its corresponding case in the width switch.stories/Modal.stories.tsx: add"full"to the Storybooksizecontrol options (kept in sync with the type via the existingassert<Equals<...>>check).This is purely additive — default (
"medium") and existing sizes are untouched.