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

Adds daySize prop to the DRP/SDP/DP that scales everything accordingly #249

Closed
wants to merge 1 commit into from

Conversation

majapw
Copy link
Collaborator

@majapw majapw commented Jan 12, 2017

Basically, this conflates all of the code associated with the width of the DayPicker into the JS side of things (which again, will be nice for using react-with-styles). The DRP/SDP now take a daySize prop (specifically a numerical pixel value) and then does all of its calculations based on that.

This should be a fix for #203

~~I'm going to add one more commit that modifies the height calculations to use this number as well instead of reaching into the DOM. ~~
Just kidding! The fact that the month title size is still not available to me is a problem. We'll just have to wait til everything is in one place with react-with-styles

to: @airbnb/webinfra @moonboots @ljharb
fyi: @cemremengu

@majapw majapw added the semver-major: breaking change A non-backwards-compatible change; anything that breaks code - including adding a peerDep. label Jan 12, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 87.143% when pulling cb5b42e on maja-add-calendarday-size-prop into f931a82 on master.

onDayMouseEnter={this.onDayMouseEnter}
onDayMouseLeave={this.onDayMouseLeave}
onDayMouseDown={this.onDayClick}
onDayTouchTap={this.onDayClick}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these props unused?

Copy link
Collaborator Author

@majapw majapw Jan 12, 2017

Choose a reason for hiding this comment

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

yeah. this was a mistake in a refactor.

@@ -0,0 +1,5 @@
const CALENDAR_MONTH_PADDING = 9;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this a property as well?

Copy link
Collaborator Author

@majapw majapw Jan 12, 2017

Choose a reason for hiding this comment

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

probs. the DAY_PICKER_PADDING is also separate. This is the padding on each month (and between months as well).

@@ -36,6 +37,7 @@ const defaultProps = {
enableOutsideDays: false,
modifiers: {},
orientation: HORIZONTAL_ORIENTATION,
daySize: 39,
Copy link
Member

Choose a reason for hiding this comment

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

why 39?

@@ -55,6 +57,7 @@ const defaultProps = {
onDayTouchTap() {},
onMonthTransitionEnd() {},
transform: 'none',
daySize: 39,
Copy link
Member

Choose a reason for hiding this comment

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

if 39 is important, could it be a reused constant, instead of being hardcoded in multiple places?

@@ -32,6 +33,7 @@ const propTypes = {
onDayTouchTap: PropTypes.func,
onMonthTransitionEnd: PropTypes.func,
transformValue: PropTypes.string,
daySize: PropTypes.number,
Copy link
Member

Choose a reason for hiding this comment

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

should this perhaps be a finite, positive integer? If so, airbnb-prop-types has nonNegativeInteger for just this use case :-D

@majapw majapw force-pushed the maja-add-calendarday-size-prop branch from a954dec to 0a56618 Compare February 13, 2017 22:33
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 86.765% when pulling 0a56618 on maja-add-calendarday-size-prop into 3e534c8 on master.

@zachfeldman
Copy link

Heeeeey @majapw how's this going? I was considering trying to break it off myself in the next few days as it would be very helpful for my inline picker being mobile friendly!

@majapw
Copy link
Collaborator Author

majapw commented Mar 30, 2017

Closing in favor of #406

@majapw majapw closed this Mar 30, 2017
@ljharb ljharb deleted the maja-add-calendarday-size-prop branch March 30, 2017 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major: breaking change A non-backwards-compatible change; anything that breaks code - including adding a peerDep.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants