Skip to content
Permalink
Browse files

chore(DatePicker): Optimization code.

  • Loading branch information...
jaywcjlove committed Apr 20, 2018
1 parent b272adf commit a65a03401feb5cf9bd270dbd59e570d2d0759842
Showing with 4 additions and 6 deletions.
  1. +3 −5 src/date-picker/DatePanelBody.js
  2. +1 −1 src/date-picker/style/datepicker.less
@@ -45,7 +45,6 @@ export default class DatePanelBody extends Component {
renderTodayLabel = () => {
const { prefixCls, showToday, onPicked } = this.props;
const { labelToday } = this.state;
if (!showToday) return null;
return (
<a className={`${prefixCls}-today-btn`} onClick={() => { onPicked(new Date()); }}>
{showToday && showToday === true ? labelToday : showToday}
@@ -55,7 +54,6 @@ export default class DatePanelBody extends Component {
renderTimeLabel = () => {
const { prefixCls, showTime } = this.props;
const { labelTimeVisible } = this.state;
if (!showTime) return null;
const timeLabel = labelTimeVisible ? '选择日期' : '选择时间';
return (
<a className={`${prefixCls}-time-btn`} onClick={this.onSelectTime}>
@@ -113,7 +111,7 @@ export default class DatePanelBody extends Component {
shortcut.onClick();
}
render() {
const { prefixCls, format, weekLabel, onPicked, shortcutinline, showTime, renderDate, shortcutClassName, disabledDate, shortcuts } = this.props;
const { prefixCls, format, weekLabel, onPicked, shortcutinline, showTime, renderDate, shortcutClassName, showToday, disabledDate, shortcuts } = this.props;
const { value, labelToday, selectDate, selectTime, selectYear, selectMonth, labelTimeVisible } = this.state;
const datePanel = isDate(value) ? new Date(value) : new Date();

@@ -136,8 +134,8 @@ export default class DatePanelBody extends Component {

const LabelFooter = (
<div className={`${prefixCls}-footer`}>
{this.renderTodayLabel()}
{this.renderTimeLabel()}
{showToday && this.renderTodayLabel()}
{showTime && this.renderTimeLabel()}
</div>
);

@@ -138,7 +138,7 @@
&-footer {
background: #fafafa;
border-radius: 0 0 4px 4px;
min-height: 10px;
min-height: 5px;
line-height: 26px;
padding: 0 5px;
&:after {

0 comments on commit a65a034

Please sign in to comment.
You can’t perform that action at this time.