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

Redo DateInput using downshift #281

Merged
merged 7 commits into from
Dec 5, 2018
Merged

Conversation

dferber90
Copy link
Contributor

@dferber90 dferber90 commented Dec 3, 2018

This is the new DateInput based on downshift.

Before  After
image image

I will add follow-up PRs to replace DateTimeInput and to add DateRangeInput based on this one.

Breaking Change Previously onChange would be called with the value directly. Now it gets called with an event containing the value. This was done to be in line with how the other inputs work.

Copy link
Contributor

@montezume montezume left a comment

Choose a reason for hiding this comment

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

This seems really clean. 👍

@dferber90 dferber90 force-pushed the df-redo-date-input-using-downshift branch from df503d4 to 5d790e5 Compare December 3, 2018 13:30
Copy link
Contributor

@montezume montezume left a comment

Choose a reason for hiding this comment

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

Looks really clean to me, and I tested the UI and it works really nice as well. Good job.

import React from 'react';
import PropTypes from 'prop-types';
import requiredIf from 'react-required-if';
import Downshift from 'downshift';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that we're not importing moment into this component at all. All usage of moment is moved to the utils. This allows to use the date-input (and the other ones) with any date-library (like date-fns).

Copy link
Contributor

@pa3 pa3 left a comment

Choose a reason for hiding this comment

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

Looks very good! Good job!

}

.year > * {
margin: 0 0 0 4px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am such a party pooper! Why not 6px?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both 4px and 6px are part of our design system. Why would you prefer 6px?


.menu {
composes: menuBase;
padding-bottom: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a sum of 4 and 6 on the .container? Should we have variables and a calc here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the sum of anything to my knowledge. We don't need to have a design token for everything, it's okay if edge-cases use their own values. A date-calendar is a one-off component imho. There is no token for a spacing of 10 either, so I hardcoded it.

@dferber90 dferber90 force-pushed the df-redo-date-input-using-downshift branch from fa849a1 to 9ebae36 Compare December 5, 2018 09:47
@dferber90 dferber90 force-pushed the df-redo-date-input-using-downshift branch from 3ac9eb3 to 2932680 Compare December 5, 2018 09:59
@dferber90 dferber90 merged commit 1f28a55 into master Dec 5, 2018
@dferber90 dferber90 deleted the df-redo-date-input-using-downshift branch December 23, 2018 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants