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

[Datepicker] Redesign datepicker as per material spec #3739

Merged
merged 14 commits into from
May 6, 2016

Conversation

tintin1343
Copy link
Contributor

@tintin1343 tintin1343 commented Mar 18, 2016

  • PR has tests / docs demo, and is linted.
  • Commit and PR titles begin with [ComponentName], and are in imperative form: "[Component] Fix leaky abstraction".
  • Description explains the issue / use-case resolved, and auto-closes the related issue(s) (http://tr.im/vFqem).

This PR deals with the following:

  • Fixes left pane length
  • Fixes Font weight of left pane date
  • Action buttons are part of calender
  • Action buttons in the year container
  • Vertical Spacing in calendar Month reduced
  • Aligned left and right arrows with days of week
  • Flex design in calender toolbar
  • Incorporated flex design for the overall calender and datepicker
  • Fix both dialog and inline calendar
  • Change year Selector in Year Container as per Material Spec.
  • Change year change animation to left and right as per spec.

Closes #3603.
Closes #3740.
Closes mui/mui-x#7515.
Closes #1489.
Closes #3046.

@tintin1343 tintin1343 force-pushed the datepicker-redesign branch 2 times, most recently from 045d5bb to f437272 Compare March 18, 2016 20:59
@mbrookes
Copy link
Member

Hi Nitin, nice work! The landscape picker looks much better already!

Just a few style tweaks as promised in gitter 😄 :

(1) The date selector overlaps the current selection:

image

In general the vertical spacing looks a bit tight, so increasing that slightly will probably fix this overlap issue too.

(2) The days should be vertically aligned with the dates:

image

This left margin may be the issue:

image

(3) There needs to be some margin around the calendar, at least on the sides and bottom, and 8px between the buttons:

image

(4) If we're aiming to follow the spec, it looks like the buttons have a smaller min-width. (Note how the OK button is narrower, even with the extra margin in the MD spec):

image

That may be a fault with our button component, but for now you could override it for the calendar.

(5) In 0.15.0-alpha.2, the calendar used to have an animated transition when changing month, similar to:

https://material-design.storage.googleapis.com/publish/material_v_4/material_ext_publish/0B6Okdz75tqQsSm5KN1FNQXRFRDA/components_pickers_date_navigation_xhdpi_004.webm

Also in that video, you'll notice the calendar maintains it's height when the number of weeks changes. Currently ours jumps p and down in height. This also affects the year selector.

(6) The hover state for the year selector in the redesigned picker should be different to the selected year:

image

Google don't give any hints here, but it should probably be an intermediate state, not the same as the selected year - smaller size than selected, and the lighter green color. IT should probably transition between states.

(7) The font size for the unselected years is too small.

Redesigned picker:

image

Spec:

image

  1. There's a min-height missing somewhere in the portrait picker:

image

Expect more to follow, but that should keep you busy for a little while 😄

@mbrookes mbrookes added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI design: material This is about Material Design, please involve a visual or UX designer in the process labels Mar 18, 2016
@mbrookes
Copy link
Member

Need to check this for #1489.

@tintin1343
Copy link
Contributor Author

@mbrookes : Alright. Will do.

@tintin1343
Copy link
Contributor Author

@mbrookes : Suggestions have been implemented. Looking forward to your suggestions. As far as #1489 is concerned there is an issue with months with 6 rows in them (in Safari) let me see what I can do about it.

@tintin1343
Copy link
Contributor Author

tintin1343 commented Mar 21, 2016

  • The date selector overlaps the current selection:
  • The days should be vertically aligned with the dates:
  • There needs to be some margin around the calendar, at least on the sides and bottom, and 8px between the buttons:
  • If we're aiming to follow the spec, it looks like the buttons have a smaller min-width. (Note how the OK button is narrower, even with the extra margin in the MD spec):
  • In 0.15.0-alpha.2, the calendar used to have an animated transition when changing month.
  • The hover state for the year selector in the redesigned picker should be different to the selected
  • The font size for the unselected years is too small.
  • There's a min-height missing somewhere in the portrait picker
  • The year list be laid out with fixed spacing so it doesn't reposition later years on font size change of earlier ones

@mbrookes: Just added these for you to uncheck if you feel it needs more work. 😀

@tintin1343
Copy link
Contributor Author

@mbrookes : This should resolve #1489

@mbrookes
Copy link
Member

@tintin1343 - getting there! 👍

I've unchecked the ones that don't appear to have been addressed yet.

Also:

The hover state for the year selector in the redesigned picker should be different to the selected

It's better, I don't think the currently selected year should shrink when hovered, also could the list be laid out with fixed spacing so it doesn't reposition later years on font size change of earlier ones?

@tintin1343
Copy link
Contributor Author

  • The date selector overlaps the current selection:
  • The days should be vertically aligned with the dates:
  • There needs to be some margin around the calendar, at least on the sides and bottom, and 8px between the buttons:
  • If we're aiming to follow the spec, it looks like the buttons have a smaller min-width. (Note how the OK button is narrower, even with the extra margin in the MD spec):
  • In 0.15.0-alpha.2, the calendar used to have an animated transition when changing month.
  • The hover state for the year selector in the redesigned picker should be different to the selected
  • The font size for the unselected years is too small.
  • There's a min-height missing somewhere in the portrait picker
  • The year list be laid out with fixed spacing so it doesn't reposition later years on font size change of earlier ones
  • On safari the datepicker doesn't display the last row correctly #1489
  • [Datepicker] Error change month button in Firefox mui-x#7515

@mbrookes : Please check again. I made the changes you mentioned where not fixed.

@mbrookes
Copy link
Member

Hi Nitin, getting there. A few more tweaks as mentioned:

  1. The days should be vertically aligned with the dates:
    image
    (Also, they appear to be using floats rather than flex, could you fix that?)

  2. Button padding should follow MD guidlines:

image

(8px above, below and to the right). Same for the Year selector.

  1. Also from the spec above, 24px from the bottom of the last row of numbers to the top of the buttons (it's too large at the moment).

  2. Dialog button minWidth should be 64px (including text padding):

image

  1. Year selector font sizes for both selected and unselected are still too small, and the vertical spacing too large:

image

  1. Dialog changes size between month and year selectors:

image

(might be related to the lack of padding below the buttons.)

  1. The years in the year selector are off center again (see image above).

  2. This is still happening:

image

(But maybe you just hadn't pushed that change.)

All that said, I'm assuming the internal structure is reasonable, but I'll let one of the others comment.

@tintin1343
Copy link
Contributor Author

Thanks @mbrookes! Those are some amazing observations.

I will work on em right away.

@tintin1343
Copy link
Contributor Author

@mbrookes: Updated the changes:

  • The days should be vertically aligned with the dates:
  • Button padding should follow MD guidlines:
  • Also from the spec above, 24px from the bottom of the last row of numbers to the top of the buttons (it's too large at the moment).
  • Dialog button minWidth should be 64px (including text padding):
  • Year selector font sizes for both selected and unselected are still too small, and the vertical spacing too large:
  • Dialog changes size between month and year selectors:
  • The years in the year selector are off center again (see image above).
  • Height Issue.

I am not able to reproduce the last one. Can you help me with it?

@mbrookes
Copy link
Member

Last few issues outstanding.

  1. Month animation direction is reversed.
  1. Still no button margin:

image

And the buttons look too tall. Check the spec again (layout and visual).

  1. Also from the spec above, 24px from the bottom of the last row of numbers to the top of the button margin (it's too large at the moment).

Still appears to be about 78px:

image

Only if you wanted to try, it would be pretty cool if when you click in a year, it animates to adopt the selected year position, and size.

@nathanmarks
Copy link
Member

nathanmarks commented May 3, 2016

Letters are cut off here due to the overflow being hidden:

@nathanmarks
Copy link
Member

nathanmarks commented May 3, 2016

These buttons need to be minWidth: 64

@tintin1343
Copy link
Contributor Author

tintin1343 commented May 3, 2016

Letters are cut off here due to the overflow being hidden:

@nathanmarks : which browser? Looks fine in chrome, Safari and firefox

screen shot 2016-05-03 at 6 12 47 pm

These buttons need to be minWidth: 64

They do have.

  },
      flatButtons: {
        fontsize: 14,
        margin: '4px 8px 8px 0px',
        maxHeight: 36,
-->    minWidth: 64,
        padding: 0,
      },

The CalendarActionButtons.js file has this.

@nathanmarks
Copy link
Member

@tintin1343 I was on the wrong PR 😄

@tintin1343
Copy link
Contributor Author

@nathanmarks U scared me man. :p

@nathanmarks
Copy link
Member

nathanmarks commented May 3, 2016

@tintin1343 hahaah

I think we should force the month onto the 2nd line here, under all circumstances:

img

usually it is like

img

@tintin1343
Copy link
Contributor Author

@nathanmarks : I agree. Let me fix that.

@@ -128,12 +129,14 @@ class DateDisplay extends Component {
const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context, this.state);
const year = selectedDate.getFullYear();
const regex = /[.,]/;
const delimiter = this.props.locale === 'fr' ? '.' : ',';
Copy link
Member

Choose a reason for hiding this comment

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

hey dude, this technique isn't going to be scalable... I think we may just have to leave it as it was 😞 there's no way we can account for all the possible locales that a user might pass if they are providing the formatter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know and I agree. This is what I was thinking when I was considering locales. However I don't think this would do any harm as most of the locales will use either a comma or a dot. Only crazy thing would be if there is a hypen or slash.

I can do one thing and it's a crude way/ hack. Leave it as it was append   after weekday so that it pushes the day and month to the bottom. What say?

Copy link
Contributor Author

@tintin1343 tintin1343 May 4, 2016

Choose a reason for hiding this comment

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

I meant append....&nbsp..

@tintin1343 tintin1343 force-pushed the datepicker-redesign branch 5 times, most recently from ebc661d to 8211ddf Compare May 4, 2016 14:13
@@ -47,7 +46,7 @@ class Calendar extends React.Component {
open: PropTypes.bool,
shouldDisableDate: PropTypes.func,
showActionButtons: PropTypes.bool,
wordings: PropTypes.object,
wordings: deprecated(PropTypes.object, 'Instead, use `cancelLabel` and `okLabel`.'),
Copy link
Member

Choose a reason for hiding this comment

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

You should only need the warning in DatePicker, otherwise the warning will fire multiple times as the value propagates down the component tree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -46,7 +45,7 @@ class Calendar extends Component {
open: PropTypes.bool,
shouldDisableDate: PropTypes.func,
showActionButtons: PropTypes.bool,
wordings: deprecated(PropTypes.object, 'Instead, use `cancelLabel` and `okLabel`.'),
wordings: PropTypes.object,
Copy link
Member

Choose a reason for hiding this comment

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

Why are we getting rid of a deprecated function without removing the prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mbrookes asked me to just keep it in the Datepicker and remove em from the child components.

Copy link
Member

Choose a reason for hiding this comment

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

@tintin1343 ahhhh ok!

@tintin1343
Copy link
Contributor Author

@mbrookes : Fixed the issues that we discussed.

@mbrookes mbrookes added PR: Review Accepted and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels May 5, 2016
@nathanmarks nathanmarks merged commit 4378b84 into mui:master May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design: material This is about Material Design, please involve a visual or UX designer in the process
Projects
None yet
4 participants