Skip to content

Commit fc5a4db

Browse files
committed
fix(Calendar): Add container props.
1 parent 944858c commit fc5a4db

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/components/Calendar.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export class Calendar extends Component {
1818
selectedDay: PropTypes.object,
1919
defaultMonth: PropTypes.object,
2020
onSelect: PropTypes.func,
21-
onClickOutside: PropTypes.func
21+
onClickOutside: PropTypes.func,
22+
containerProps: PropTypes.object
2223
};
2324

2425
static childContextTypes = {
@@ -29,7 +30,8 @@ export class Calendar extends Component {
2930
};
3031

3132
static defaultProps = {
32-
styles: require('../styles/basic.css')
33+
styles: require('../styles/basic.css'),
34+
containerProps: {}
3335
};
3436

3537
state = {
@@ -163,13 +165,12 @@ export class Calendar extends Component {
163165
onClickOutside,
164166
outsideClickIgnoreClass,
165167
styles,
166-
className,
167-
...rest
168+
className
168169
} = this.props;
169170
const { mode } = this.state;
170171

171172
return (
172-
<div className={styles.calendarContainer + ' ' + className} {...rest}>
173+
<div className={styles.calendarContainer + ' ' + className}>
173174
{ mode === 'monthSelector' ? this.renderMonthSelector() : this.renderDays() }
174175
</div>
175176
);

src/components/DatePicker.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ export default class DatePicker extends Component {
2020
inputFormat: PropTypes.string,
2121
removable: PropTypes.bool,
2222
timePickerComponent: PropTypes.func,
23-
calendarStyles: PropTypes.object
23+
calendarStyles: PropTypes.object,
24+
calendarContainerProps: PropTypes.object
2425
};
2526

2627
static defaultProps = {
2728
inputFormat: 'jYYYY/jM/jD',
28-
calendarStyles: require('../styles/basic.css')
29+
calendarStyles: require('../styles/basic.css'),
30+
calendarContainerProps: {}
2931
};
3032

3133
state = {
@@ -139,7 +141,7 @@ export default class DatePicker extends Component {
139141

140142
renderCalendar() {
141143
const { momentValue } = this.state;
142-
const { timePickerComponent: TimePicker, onChange, min, max, defaultMonth, calendarStyles } = this.props;
144+
const { timePickerComponent: TimePicker, onChange, min, max, defaultMonth, calendarStyles, calendarContainerProps } = this.props;
143145

144146
return (
145147
<div>
@@ -152,6 +154,7 @@ export default class DatePicker extends Component {
152154
onClickOutside={this.handleClickOutsideCalendar.bind(this) }
153155
outsideClickIgnoreClass={outsideClickIgnoreClass}
154156
styles={calendarStyles}
157+
containerProps={calendarContainerProps}
155158
>
156159
{
157160
TimePicker ? (

0 commit comments

Comments
 (0)