This repository was archived by the owner on Jul 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 826
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
[DatePicker] Update to match the specification (desktop) #1648
Copy link
Copy link
Closed
Labels
Description
Environment
Tech | Version |
---|---|
@material-ui/pickers | v4.0.0-alpha.5 |
Steps to reproduce
https://next.material-ui-pickers.dev/demo/datepicker#basic-usage
Actual behavior
Expected behavior
- The component should have a higher density on desktop. It should be 258x281 instead of 320x358.
- The popper should be positioned to start on the right side, not at the center.
- The day chip should be 28x28 (maybe less, not sure) instead of 36x36 pixels.
- The year chip should be 54x28 instead of 72x36 pixels.
- The colors of the range don't match. Try to set the same primary color as in material.io
#7001f3
to get an idea of the issue. I propose this diff:
diff --git a/lib/src/DateRangePicker/DateRangePickerDay.tsx b/lib/src/DateRangePicker/DateRangePickerDay.tsx
index 9f54cb31..bff27496 100644
--- a/lib/src/DateRangePicker/DateRangePickerDay.tsx
+++ b/lib/src/DateRangePicker/DateRangePickerDay.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import clsx from 'clsx';
import { DAY_MARGIN } from '../constants/dimensions';
import { useUtils } from '../_shared/hooks/useUtils';
-import { makeStyles, fade } from '@material-ui/core/styles';
+import { makeStyles, fade, lighten } from '@material-ui/core/styles';
import { Day, DayProps, areDayPropsEqual } from '../views/Calendar/Day';
interface DateRangeDayProps extends DayProps {
@@ -38,8 +38,8 @@ const useStyles = makeStyles(
},
rangeIntervalDayHighlight: {
borderRadius: 0,
- color: theme.palette.primary.contrastText,
- backgroundColor: fade(theme.palette.primary.light, 0.6),
+ color: theme.palette.getContrastText(lighten(theme.palette.primary.main, 0.8)),
+ backgroundColor: lighten(theme.palette.primary.main, 0.8),
'&:first-child': startBorderStyle,
'&:last-child': endBorderStyle,
},
@@ -66,7 +66,7 @@ const useStyles = makeStyles(
},
},
dayInsideRangeInterval: {
- color: theme.palette.getContrastText(fade(theme.palette.primary.light, 0.6)),
+ color: theme.palette.getContrastText(lighten(theme.palette.primary.main, 0.8)),
},
notSelectedDate: {
backgroundColor: 'transparent',
before
after
baseline
Looking again, 0.8 isn't enough. Maybe 0.85 or 0.9.
dmtrKovalenko