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

[pickers] Fix desktop date time Pickers grid layout #12748

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ const rendererInterceptor = function rendererInterceptor<
availableRangePositions: [rangePosition],
view: !isTimeViewActive ? popperView : 'day',
views: rendererProps.views.filter(isDatePickerView),
sx: [{ gridColumn: 1 }, ...finalProps.sx],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We often do the following:

      sx={[...(Array.isArray(formControlSx) ? formControlSx : [formControlSx])]}

Are we sure finalProps.sx is an array here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we are sure:

sx: [
{
[`&.${multiSectionDigitalClockClasses.root}`]: {
borderBottom: 0,
},
[`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}, &.${digitalClockClasses.root}`]:
{
maxHeight: RANGE_VIEW_HEIGHT,
},
},
],
};

If my memory serves well, I've tested and identified that there is no way for otherProps.sx to be present here. 🤔

})}
<Divider orientation="vertical" />
<Divider orientation="vertical" sx={{ gridColumn: 2 }} />
<DateTimeRangePickerTimeWrapper
{...finalProps}
view={isTimeViewActive ? popperView : 'hours'}
Expand All @@ -106,6 +107,7 @@ const rendererInterceptor = function rendererInterceptor<
{}
>
}
sx={[{ gridColumn: 3 }, ...finalProps.sx]}
/>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,18 @@ const rendererInterceptor = function rendererInterceptor<
view: !isTimeViewActive ? popperView : 'day',
focusedView: focusedView && isDatePickerView(focusedView) ? focusedView : null,
views: rendererProps.views.filter(isDatePickerView),
sx: [{ gridColumn: 1 }, ...finalProps.sx],
})}
{timeViewsCount > 0 && (
<React.Fragment>
<Divider orientation="vertical" />
<Divider orientation="vertical" sx={{ gridColumn: 2 }} />
{inViewRenderers[isTimeViewActive ? popperView : 'hours']?.({
...finalProps,
view: isTimeViewActive ? popperView : 'hours',
focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
openTo: isInternalTimeView(openTo) ? openTo : 'hours',
views: rendererProps.views.filter(isInternalTimeView),
sx: [{ gridColumn: 3 }, ...finalProps.sx],
})}
</React.Fragment>
)}
Expand Down