Skip to content

Commit

Permalink
Merge pull request #203 from react-component/ux-year-panel
Browse files Browse the repository at this point in the history
css: improve UX, close: ant-design/ant-design#4415
  • Loading branch information
yiminghe committed Jan 11, 2017
2 parents bb94d60 + 25b648f commit cc32910
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 33 deletions.
12 changes: 1 addition & 11 deletions assets/index/DecadePanel.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@
.@{prefixClass}-decade-panel-decade{
user-select: none;
-webkit-user-select: none;
}
.@{prefixClass}-decade-panel-decade:before {
content: ">";
font-family: "iconfont" !important;
}
}

.@{prefixClass}-decade-panel-last-century-cell {
.@{prefixClass}-decade-panel-decade {
transform: rotate(180deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
color: rgba(0, 0, 0, 0.25);
}
}
12 changes: 1 addition & 11 deletions assets/index/YearPanel.less
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@
.@{prefixClass}-year-panel-year{
user-select: none;
-webkit-user-select: none;
}
.@{prefixClass}-year-panel-year:before {
content: ">";
font-family: "iconfont" !important;
}
}

.@{prefixClass}-year-panel-last-decade-cell {
.@{prefixClass}-year-panel-year {
transform: rotate(180deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
color: rgba(0, 0, 0, 0.25);
}
}
3 changes: 1 addition & 2 deletions src/decade/DecadePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ class DecadePanel extends React.Component {
[`${prefixCls}-last-century-cell`]: isLast,
[`${prefixCls}-next-century-cell`]: isNext,
};
let content;
const content = `${dStartDecade}-${dEndDecade}`;
let clickHandler;
if (isLast) {
clickHandler = this.previousCentury;
} else if (isNext) {
clickHandler = this.nextCentury;
} else {
content = `${dStartDecade}-${dEndDecade}`;
clickHandler = chooseDecade.bind(this, dStartDecade);
}
return (<td
Expand Down
10 changes: 1 addition & 9 deletions src/year/YearPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,13 @@ class YearPanel extends React.Component {
const currentYear = value.year();
const startYear = parseInt(currentYear / 10, 10) * 10;
const previousYear = startYear - 1;
const endYear = startYear + 9;
const years = [];
let index = 0;
for (let rowIndex = 0; rowIndex < ROW; rowIndex++) {
years[rowIndex] = [];
for (let colIndex = 0; colIndex < COL; colIndex++) {
const year = previousYear + index;
let content;
if (year < startYear) {
content = '';
} else if (year > endYear) {
content = '';
} else {
content = String(year);
}
const content = String(year);
years[rowIndex][colIndex] = {
content,
year,
Expand Down

0 comments on commit cc32910

Please sign in to comment.