Skip to content

Commit

Permalink
Simplify daySize
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Zhang committed Mar 27, 2017
1 parent fe5ee49 commit 6dfdab4
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/CalendarDay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const propTypes = forbidExtraProps({

const defaultProps = {
day: moment(),
daySize: 39,
daySize: 40,
isOutsideDay: false,
modifiers: {},
onDayClick() {},
Expand Down
2 changes: 1 addition & 1 deletion src/components/CalendarMonth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const defaultProps = {
enableOutsideDays: false,
modifiers: {},
orientation: HORIZONTAL_ORIENTATION,
daySize: 39,
daySize: 40,
onDayClick() {},
onDayMouseEnter() {},
onDayMouseLeave() {},
Expand Down
2 changes: 1 addition & 1 deletion src/components/CalendarMonthGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const defaultProps = {
onMonthTransitionEnd() {},
renderDay: null,
transformValue: 'none',
daySize: 39,
daySize: 40,

// i18n
monthFormat: 'MMMM YYYY', // english locale
Expand Down
2 changes: 1 addition & 1 deletion src/components/DateRangePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const defaultProps = {
keepOpenOnDateSelect: false,
reopenPickerOnClearDates: false,
renderCalendarInfo: null,
daySize: 39,
daySize: 40,

// navigation related props
navPrev: null,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DayPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const defaultProps = {
hidden: false,
initialVisibleMonth: () => moment(),
renderCalendarInfo: null,
daySize: 39,
daySize: 40,

// navigation props
navPrev: null,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DayPickerRangeController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const defaultProps = {
withPortal: false,

initialVisibleMonth: () => moment(),
daySize: 39,
daySize: 40,

navPrev: null,
navNext: null,
Expand Down
2 changes: 1 addition & 1 deletion src/components/SingleDatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const defaultProps = {
keepOpenOnDateSelect: false,
reopenPickerOnClearDate: false,
renderCalendarInfo: null,
daySize: 39,
daySize: 40,

// navigation related props
navPrev: null,
Expand Down
6 changes: 2 additions & 4 deletions src/utils/getCalendarMonthWidth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const CALENDAR_MONTH_PADDING = 9;

export default function getCalendarMonthWidth(daySize) {
return (7 * (daySize + 1)) + (2 * (CALENDAR_MONTH_PADDING + 1));
export default function getCalendarMonthWidth(daySize, monthPadding = 10) {
return (7 * daySize) + (2 * monthPadding);
}
4 changes: 2 additions & 2 deletions test/utils/getCalendarMonthWidth_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from 'chai';
import getCalendarMonthWidth from '../../src/utils/getCalendarMonthWidth';

describe('#getCalendarMonthWidth', () => {
it('correctly calculates width for default day size of 39', () => {
expect(getCalendarMonthWidth(39)).to.equal(300);
it('correctly calculates width for default day size of 40', () => {
expect(getCalendarMonthWidth(40)).to.equal(300);
});
});

0 comments on commit 6dfdab4

Please sign in to comment.