Skip to content

Commit

Permalink
Add theme prop in prep for react-with-styles and the like
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Wichrowska committed Mar 31, 2017
1 parent 197f6ae commit f92b63c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 45 deletions.
8 changes: 5 additions & 3 deletions src/components/CalendarDay.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { PropTypes } from 'react';
import shallowCompare from 'react-addons-shallow-compare';
import momentPropTypes from 'react-moment-proptypes';
import { forbidExtraProps } from 'airbnb-prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import moment from 'moment';
import cx from 'classnames';

import { DAY_SIZE } from '../constants';

const propTypes = forbidExtraProps({
day: momentPropTypes.momentObj,
daySize: PropTypes.number,
daySize: nonNegativeInteger,
isOutsideDay: PropTypes.bool,
modifiers: PropTypes.object,
onDayClick: PropTypes.func,
Expand All @@ -18,7 +20,7 @@ const propTypes = forbidExtraProps({

const defaultProps = {
day: moment(),
daySize: 39,
daySize: DAY_SIZE,
isOutsideDay: false,
modifiers: {},
onDayClick() {},
Expand Down
7 changes: 4 additions & 3 deletions src/components/CalendarMonth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React, { PropTypes } from 'react';
import shallowCompare from 'react-addons-shallow-compare';
import momentPropTypes from 'react-moment-proptypes';
import { forbidExtraProps } from 'airbnb-prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import moment from 'moment';
import cx from 'classnames';

Expand All @@ -17,6 +17,7 @@ import {
HORIZONTAL_ORIENTATION,
VERTICAL_ORIENTATION,
VERTICAL_SCROLLABLE,
DAY_SIZE,
} from '../../constants';

const propTypes = forbidExtraProps({
Expand All @@ -25,7 +26,7 @@ const propTypes = forbidExtraProps({
enableOutsideDays: PropTypes.bool,
modifiers: PropTypes.object,
orientation: ScrollableOrientationShape,
daySize: PropTypes.number,
daySize: nonNegativeInteger,
onDayClick: PropTypes.func,
onDayMouseEnter: PropTypes.func,
onDayMouseLeave: PropTypes.func,
Expand All @@ -41,7 +42,7 @@ const defaultProps = {
enableOutsideDays: false,
modifiers: {},
orientation: HORIZONTAL_ORIENTATION,
daySize: 39,
daySize: DAY_SIZE,
onDayClick() {},
onDayMouseEnter() {},
onDayMouseLeave() {},
Expand Down
7 changes: 4 additions & 3 deletions src/components/CalendarMonthGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PropTypes } from 'react';
import shallowCompare from 'react-addons-shallow-compare';
import momentPropTypes from 'react-moment-proptypes';
import { forbidExtraProps } from 'airbnb-prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import moment from 'moment';
import cx from 'classnames';
import { addEventListener, removeEventListener } from 'consolidated-events';
Expand All @@ -18,6 +18,7 @@ import {
HORIZONTAL_ORIENTATION,
VERTICAL_ORIENTATION,
VERTICAL_SCROLLABLE,
DAY_SIZE,
} from '../../constants';

const propTypes = forbidExtraProps({
Expand All @@ -34,7 +35,7 @@ const propTypes = forbidExtraProps({
onMonthTransitionEnd: PropTypes.func,
renderDay: PropTypes.func,
transformValue: PropTypes.string,
daySize: PropTypes.number,
daySize: nonNegativeInteger,

// i18n
monthFormat: PropTypes.string,
Expand All @@ -54,7 +55,7 @@ const defaultProps = {
onMonthTransitionEnd() {},
renderDay: null,
transformValue: 'none',
daySize: 39,
daySize: DAY_SIZE,

// i18n
monthFormat: 'MMMM YYYY', // english locale
Expand Down
4 changes: 0 additions & 4 deletions src/components/DateRangePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ const defaultProps = {
navPrev: null,
navNext: null,

onDatesChange() {},
onFocusChange() {},
onPrevMonthClick() {},
onNextMonthClick() {},

Expand Down Expand Up @@ -240,12 +238,10 @@ export default class DateRangePicker extends React.Component {
maybeRenderDayPickerWithPortal() {
const { withPortal, withFullScreenPortal } = this.props;

console.log('hello world')
if (!this.isOpened()) {
return null;
}

console.log('hello')
if (withPortal || withFullScreenPortal) {
return (
<Portal isOpened>
Expand Down
24 changes: 1 addition & 23 deletions src/components/DayPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ export default class DayPicker extends React.Component {
role="region"
tabIndex={-1}
>
<<<<<<< HEAD
{!verticalScrollable && this.renderNavigation()}

<div
Expand All @@ -526,33 +525,12 @@ export default class DayPicker extends React.Component {
renderDay={renderDay}
onMonthTransitionEnd={this.updateStateAfterMonthTransition}
monthFormat={monthFormat}
daySize={daySize}
/>
{verticalScrollable && this.renderNavigation()}
</div>

{renderCalendarInfo && renderCalendarInfo()}
=======
<CalendarMonthGrid
ref={(ref) => { this.calendarMonthGrid = ref; }}
transformValue={transformValue}
enableOutsideDays={enableOutsideDays}
firstVisibleMonthIndex={firstVisibleMonthIndex}
initialMonth={currentMonth}
isAnimating={isCalendarMonthGridAnimating}
modifiers={modifiers}
orientation={orientation}
withPortal={withPortal}
numberOfMonths={numberOfMonths * scrollableMonthMultiple}
onDayClick={onDayClick}
onDayMouseEnter={onDayMouseEnter}
onDayMouseLeave={onDayMouseLeave}
renderDay={renderDay}
onMonthTransitionEnd={this.updateStateAfterMonthTransition}
monthFormat={monthFormat}
daySize={daySize}
/>
{verticalScrollable && this.renderNavigation()}
>>>>>>> Adds daySize prop to the DRP/SDP/DP that scales everything accordingly
</div>
</OutsideClickHandler>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/components/DayPickerRangeController.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { PropTypes } from 'react';
import momentPropTypes from 'react-moment-proptypes';
import { forbidExtraProps } from 'airbnb-prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import moment from 'moment';

import { DayPickerPhrases } from '../defaultPhrases';
Expand All @@ -19,6 +19,7 @@ import {
START_DATE,
END_DATE,
HORIZONTAL_ORIENTATION,
DAY_SIZE,
} from '../../constants';

import DayPicker from './DayPicker';
Expand All @@ -43,7 +44,7 @@ const propTypes = forbidExtraProps({
orientation: ScrollableOrientationShape,
withPortal: PropTypes.bool,
initialVisibleMonth: PropTypes.func,
daySize: PropTypes.number,
daySize: nonNegativeInteger,

navPrev: PropTypes.node,
navNext: PropTypes.node,
Expand Down Expand Up @@ -83,7 +84,7 @@ const defaultProps = {
withPortal: false,

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

navPrev: null,
navNext: null,
Expand Down
3 changes: 0 additions & 3 deletions src/components/SingleDatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,11 @@ export default class SingleDatePicker extends React.Component {
navPrev={navPrev}
navNext={navNext}
renderDay={renderDay}
<<<<<<< HEAD
renderCalendarInfo={renderCalendarInfo}
isFocused={isDayPickerFocused}
onBlur={this.onDayPickerBlur}
phrases={phrases}
=======
daySize={daySize}
>>>>>>> Adds daySize prop to the DRP/SDP/DP that scales everything accordingly
/>

{withFullScreenPortal && (
Expand Down
3 changes: 0 additions & 3 deletions stories/DayPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ const TestPrevIcon = () => (
Prev
</span>
);
<<<<<<< HEAD
=======

>>>>>>> Adds daySize prop to the DRP/SDP/DP that scales everything accordingly
const TestNextIcon = () => (
<span
style={{
Expand Down

0 comments on commit f92b63c

Please sign in to comment.