Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flex padding/margin overflow in Card component #554

Closed
emmenko opened this issue Feb 19, 2019 · 3 comments
Closed

Fix flex padding/margin overflow in Card component #554

emmenko opened this issue Feb 19, 2019 · 3 comments
Labels
🐛 Type: Bug Something isn't working

Comments

@emmenko
Copy link
Member

emmenko commented Feb 19, 2019

Describe the bug
The Spacing Card element (which are display: flex) should not have any padding. Instead there should be an inner container that implements the spacing padding or margin.

To Reproduce
I noticed that when implementing the {Info,Confirmation}Dialog (commercetools/merchant-center-application-kit#367, commercetools/merchant-center-application-kit#367).

screenshot 2019-02-19 at 11 07 46

According to this SO answer (https://stackoverflow.com/a/37785605) this is because of how the calculation of the flex container is done in regards to padding/margin.

Setting the padding/margin to 0 will obviously remove the "overflow".

screenshot 2019-02-19 at 11 11 27

Expected behavior
The Spacing Card component should not cause overflow on the parent container element.

I would suggest to have a wrapping <div> inside the Card container, where the <div> will set the padding/margin

screenshot 2019-02-19 at 11 14 26

I can spin up a PR to better illustrate the fix.

@emmenko emmenko added the 🐛 Type: Bug Something isn't working label Feb 19, 2019
@emmenko
Copy link
Member Author

emmenko commented Feb 19, 2019

I'm wondering though if it's a general problem or only in the dialog/modal case 🤔

I'll look into it a bit more...

@emmenko
Copy link
Member Author

emmenko commented Feb 19, 2019

Wait, I think I got confused. The container I was looking at is the <Card> container, which has the padding. 🤦‍♂️🤦‍♂️🤦‍♂️

I'll find a workaround for now then.

@emmenko emmenko closed this as completed Feb 19, 2019
@emmenko
Copy link
Member Author

emmenko commented Feb 19, 2019

Actually I think we should fix it in the <Card> component, I don't see other ways around that.

@emmenko emmenko reopened this Feb 19, 2019
@emmenko emmenko changed the title Fix flex padding/margin overflow in outer containers of Spacing components Fix flex padding/margin overflow in Card component Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant