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

[POC] Refactor PickersDay and DateRangePickerDay components #15921

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

noraleonte
Copy link
Contributor

@noraleonte noraleonte commented Dec 17, 2024

closes #14753

This is an exploration

I'm exploring the option of creating only one day component used by both simple and range pickers & writing the styles in a way that they are truly separated from each other. i.e. The selected state should not care whether isStartOfPreviewing is true or not. It just applies the styles related to selection.
I reduced the DOM structure to a single element (ButtonBase) and the previewing and highlighting (now renamed to selectedRange) is handled with pseudo elements.

The advantage of this is that we reduce the complexity of customizing this component a lot and we can avoid specificity issues. See new demo vs custom theme from the overview page

A downside is that the width and positioning of the pseudo elements is calculated based on the width and margins of the root => so any customizations of the dimensions or spacing of the root element need to be reflected in the calculation of the dimensions and positionings of the pseudo elements. We can try abstracting some of that and introducing css variables, but I think documenting this should be enough. Plus, it might even make it easier to achieve custom designs where the highlighting and previewing don't connect. (Like the picture)
image

@mui-bot
Copy link

mui-bot commented Dec 17, 2024

@flaviendelangle flaviendelangle added the component: pickers This is the name of the generic UI component, not the React module! label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pickers] Improve calendars customization
3 participants