-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Use the new ownerState
in the toolbar components
#15777
[pickers] Use the new ownerState
in the toolbar components
#15777
Conversation
Deploy preview: https://deploy-preview-15777--material-ui-x.netlify.app/ |
const slots = { | ||
root: ['root', selected && 'selected'], | ||
root: ['root'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm dropping this state class in favor of a data attribute.
We will probably drop most of them since Base UI (and therefore @mui/material
) is migrating toward data attributes. And dropping this one allowed me to not create a custom ownerState
for this component...
* If this context value is set to true, the toolbar will always be rendered in the desktop mode. | ||
* This is used by the Date Time Range Picker Toolbar. | ||
*/ | ||
export const DateTimePickerToolbarForceDesktopVariant = React.createContext(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to remove the hack of overriding toolbarVariant
to enforce desktop
layout on the DateTimeRangePickerToolbar
component.
<DateTimePickerToolbarTimeContainer | ||
className={classes.timeContainer} | ||
ownerState={ownerState} | ||
toolbarVariant={toolbarVariant} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm passing this as a prop to avoid creating a dedicated ownerState for DateTimePickerToolbar
* Is equal to "ltr" when the toolbar is in left-to-right direction. | ||
* Is equal to "rtl" when the toolbar is in right-to-left direction. | ||
*/ | ||
toolbarDirection: 'ltr' | 'rtl'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #14994 I went for isRtl
, but I think I would prefer the more descriptive {componentName}Direction
instead.
I can update the PickerLayoutOwnerState
to use layoutDirection
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6c6fd46
to
c6b8611
Compare
0baf534
to
017d97e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really nice work ... LGTM
Part of #14475