Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

[DatePicker] Update to match the specification (desktop) #1648

@oliviertassinari

Description

@oliviertassinari

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

Capture d’écran 2020-04-13 à 00 11 25

Expected behavior

Capture d’écran 2020-04-13 à 00 07 00

  1. The component should have a higher density on desktop. It should be 258x281 instead of 320x358.
  2. The popper should be positioned to start on the right side, not at the center.
  3. The day chip should be 28x28 (maybe less, not sure) instead of 36x36 pixels.
  4. The year chip should be 54x28 instead of 72x36 pixels.
  5. 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

Capture d’écran 2020-04-13 à 00 34 11

after

Capture d’écran 2020-04-13 à 00 33 18

baseline

Capture d’écran 2020-04-13 à 00 34 33

Looking again, 0.8 isn't enough. Maybe 0.85 or 0.9.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions