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

In DayPicker an hardcoded bottom margin is added to the calculated height #2175

Open
marcopiii opened this issue Jan 19, 2022 · 4 comments
Open

Comments

@marcopiii
Copy link

marcopiii commented Jan 19, 2022

react-dates version
verified on [email protected]

Describe the bug
With horizontal orientation, the element with class DayPicker_transitionContainer (which height is dynamically calculated based on the number of rows to be displayed) has a hardcoded bottom margin of 23px.

This margin is not applied as a margin-bottom property, but by adding 23px to the calculated height.
Due to this, it's not possible to customize the component via CSS to be marginless: if it was a margin-bottom you could just remove it with a margin-bottom: none !important, but since you need to rely on the calculated height you can not override that.

Kapture 2022-01-19 at 16 27 40

In the source code, I see that the property is set here with transitionContainerStyle
https://github.com/airbnb/react-dates/blob/adec1c86590f1f86a4cd2537c6b780cdc35dd812/src/components/DayPicker.jsx#L1205-L1214

and height is calculated in the following part
https://github.com/airbnb/react-dates/blob/adec1c86590f1f86a4cd2537c6b780cdc35dd812/src/components/DayPicker.jsx#L879-L890

where, as you can see, it is increased by MONTH_PADDING.

I think this could be fixed by making MONTH_PADDING customizable as a component prop, or if it is applied as a margin-bottom instead of being added to the calculated height.

Desktop (please complete the following information):

  • OS: macOS 11.4
  • Browser: Chrome
  • Version: 97.0.4692.71
@marcopiii marcopiii changed the title In DayPicker an hardcoded bottom margin in added to the calculated height In DayPicker an hardcoded bottom margin is added to the calculated height Jan 19, 2022
@AMMAR-62
Copy link

AMMAR-62 commented Feb 8, 2022

Can I take up this issue?

@ljharb
Copy link
Member

ljharb commented Feb 8, 2022

@AMMAR-62 there's no "pull request wanted" label, and there's no clear description of what, if anything, needs to be done.

@erikt9
Copy link

erikt9 commented Feb 10, 2022

I haven't tested it, but you may be able to fix it by setting margin-bottom: -23px

@ljharb
Copy link
Member

ljharb commented Feb 10, 2022

It seems fine to me to make MONTH_PADDING configurable via the react-with-styles theme, but default to 23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants