Skip to content

Commit

Permalink
feat: add extra footer to MonthCalendar (react-component#318)
Browse files Browse the repository at this point in the history
* add extral footer to MonthCalendar ant-design/ant-design#8184

* update docs
  • Loading branch information
nikogu authored and benjycui committed Nov 20, 2017
1 parent ed7d987 commit cae096e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ http://react-component.github.io/calendar/examples/index.html
<td></td>
<td>called when a date is changed inside calendar (next year/next month/keyboard)</td>
</tr>
<tr>
<td>renderFooter</td>
<td>() => React.Node</td>
<td></td>
<td>extra footer</td>
</tr>
</tbody>
</table>

Expand Down
4 changes: 0 additions & 4 deletions assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@
@import "index/DecadePanel";
@import "common/RangeCalendar";
@import "common/FullCalendar";

.@{prefixClass}-month-calendar {
height: 308px;
}
7 changes: 5 additions & 2 deletions assets/index/MonthPanel.less
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@
}
}



.@{prefixClass}-month-panel-selected-cell .@{prefixClass}-month-panel-month {
background: #3fc7fa;
color: #fff;
Expand All @@ -130,3 +128,8 @@
color: #fff;
}
}

.@{prefixClass}-month-header-wrap {
position: relative;
height: 308px;
}
33 changes: 21 additions & 12 deletions src/MonthCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import KeyCode from 'rc-util/lib/KeyCode';
import CalendarHeader from './calendar/CalendarHeader';
import CalendarFooter from './calendar/CalendarFooter';
import CalendarMixin from './mixin/CalendarMixin';
import CommonMixin from './mixin/CommonMixin';

Expand Down Expand Up @@ -74,18 +75,26 @@ const MonthCalendar = createReactClass({
const { props, state } = this;
const { mode, value } = state;
const children = (
<CalendarHeader
prefixCls={props.prefixCls}
mode={mode}
value={value}
locale={props.locale}
disabledMonth={props.disabledDate}
monthCellRender={props.monthCellRender}
monthCellContentRender={props.monthCellContentRender}
onMonthSelect={this.onSelect}
onValueChange={this.setValue}
onPanelChange={this.handlePanelChange}
/>
<div className={`${props.prefixCls}-month-calendar-content`}>
<div className={`${props.prefixCls}-month-header-wrap`}>
<CalendarHeader
prefixCls={props.prefixCls}
mode={mode}
value={value}
locale={props.locale}
disabledMonth={props.disabledDate}
monthCellRender={props.monthCellRender}
monthCellContentRender={props.monthCellContentRender}
onMonthSelect={this.onSelect}
onValueChange={this.setValue}
onPanelChange={this.handlePanelChange}
/>
</div>
<CalendarFooter
prefixCls={props.prefixCls}
renderFooter={props.renderFooter}
/>
</div>
);
return this.renderRoot({
className: `${props.prefixCls}-month-calendar`,
Expand Down

0 comments on commit cae096e

Please sign in to comment.