razorpay / blade

Design System that powers Razorpay
https://blade.razorpay.com
MIT License
507 stars 142 forks source link

Box: Support "initial" and "fit-content" for width #1314

Closed cseas closed 1 year ago

cseas commented 1 year ago

Problem

I'm working on implementing this design:

Screenshot 2023-06-16 at 2 53 14 PM

Which becomes this on mobile:

Screenshot 2023-06-16 at 2 55 01 PM

We want the last item to be on a separate line. Putting display: block on it messes up the alignment of the icon and text since their container has display: flex.

Code with the issue: https://github.com/razorpay/frontend-website/pull/2194/files#diff-1f2c8c5821f57c8376ada25679cfc0b957d02788758ba99df29d8ca16b1599b5R96

Suggestion

I could technically put another wrapper around the wrapper containing the icon and text and put a responsive display: block on that. But assuming the goal of the Layout primitives was to avoid wrapocalypse like this one.

Please support the "initial" and/or "fit-content" values for width on Box component. So we could write this:

<Box width={{ base: '100%', l: 'initial' }}>

This will render the correct layout:

Screenshot 2023-06-16 at 3 01 41 PM
divyanshu013 commented 1 year ago

Besides these we should also add other relevant values in TS, eg. min-content, max-content, inherit, unset, etc. as part of this issue