material-ui-pickers icon indicating copy to clipboard operation
material-ui-pickers copied to clipboard

Height of transitionContainer not set dynamically?

Open katy6514 opened this issue 7 years ago • 4 comments

dont-touch-my-garbage-when-a-coworker-wants-to-do-36085809

I've been looking for a while for a solution to this but I'm not sure if it's been encountered yet. Looking at all the examples of the Mui DatePickers online (and even one that I use in one part of the app I'm working on) the transitionContainer is set high enough that all weeks are visible.

However, a Mui DatePicker used elsewhere in the app (built originally by someone else no longer at the company) works wonderfully except for when the dates of the month span 6 weeks. The sixth week is always hidden. I have a suspicion that it's being hard coded somewhere in the app but it's got to be someplace I haven't looked yet.

what this currently looks like: july looks great goodJuly june's last month is hidden badJune

I've tried all the combinations of CSS settings that I can think of to try to dynamically set the height of the transitionContainer to be big enough vertically to show all weeks but so far have had no luck. Currently my solution is to use CSS overrides to hardcode the height big enough to display all weeks regardless of number of weeks needed to display. The problem is this leaves a big blank row of white at the bottom of the calendar that my design team isn't going to like.

what my hardcoded solution looks like: june looks great goodJune july has so much white space badJuly

A solution I'm hoping for is: all weeks visible goodJune no extra white space goodJuly

Versions: "react": "16.4.1", "@material-ui/core": "^3.9.2", "material-ui-pickers": "^2.2.0",

any suggestions greatly appreciated!

katy6514 avatar Jul 18 '19 23:07 katy6514

It can be done only in overrides section of mui theme. Originally we always showing the white space for 6th week

dmtrKovalenko avatar Jul 19 '19 03:07 dmtrKovalenko

I've tried all combinations of CSS overrides in the mui theme that was created and can't find a solution. Also, if the height of the transition container is being overridden somewhere already to show only 5 weeks, I cannot find where.

This is the entirety of the existing MUI theme that was in place when I got to it, excluding my transitionContainer override attempts:

const materialTheme = createMuiTheme({
  overrides: {
    MuiPickersCalendarHeader: {
      daysHeader: {
        display: 'flex',
        justifyContent: 'space-around',
        padding: 3,
      },
    },
    MuiPickersCalendar: {
      week: {
        display: 'flex',
        justifyContent: 'space-around',
        padding: 3,
      },
    },
  },
})

I don't think anything in there is setting the height to only allow 5 weeks to be displayed. Where else might I look to change the setting? Thanks for any suggestions.

katy6514 avatar Jul 23 '19 18:07 katy6514

I found a solution involving jss-nested syntax in my muiTheme! Had to target the first child div in the transition container for the MuiPickersSlideTransition like so: '&& > div': { position: 'static ',},

katy6514 avatar Jul 24 '19 21:07 katy6514

@katy6514 I came across this same issue. If I'm understanding you correctly, are you flipping the div's position from absolute to static? When I attempt this, the transitionContainer grows to roughly 2x the size on month change, due to the static positioning of the 2 divs storing the 2 months. How did you address that?

alexdao3 avatar Aug 21 '19 16:08 alexdao3