Skip to content

Commit

Permalink
修改stamp -> lable,调整 测试代码。
Browse files Browse the repository at this point in the history
  • Loading branch information
xrkffgg committed Aug 2, 2019
1 parent fe2a6eb commit f0aac11
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 50 deletions.
6 changes: 3 additions & 3 deletions components/timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface TimelineProps {
pendingDot?: React.ReactNode;
style?: React.CSSProperties;
reverse?: boolean;
mode?: 'left' | 'alternate' | 'right' | 'stamp-left' | 'stamp-right';
mode?: 'left' | 'alternate' | 'right' | 'label-left' | 'label-right';
}

export default class Timeline extends React.Component<TimelineProps, any> {
Expand Down Expand Up @@ -64,8 +64,8 @@ export default class Timeline extends React.Component<TimelineProps, any> {
if (mode === 'left') return `${prefixCls}-item-left`;
if (mode === 'right') return `${prefixCls}-item-right`;
if (ele.props.position === 'right') return `${prefixCls}-item-right`;
if (mode === 'stamp-left') return `${prefixCls}-item-stamp-left`;
if (mode === 'stamp-right') return `${prefixCls}-item-stamp-right`;
if (mode === 'label-left') return `${prefixCls}-item-label-left`;
if (mode === 'label-right') return `${prefixCls}-item-label-right`;
return '';
};

Expand Down
8 changes: 4 additions & 4 deletions components/timeline/TimelineItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TimeLineItemProps {
prefixCls?: string;
className?: string;
color?: string;
stamp?: string;
label?: string;
dot?: React.ReactNode;
pending?: boolean;
position?: string;
Expand All @@ -20,7 +20,7 @@ const TimelineItem: React.SFC<TimeLineItemProps> = props => (
prefixCls: customizePrefixCls,
className,
color = '',
stamp = '',
label = '',
children,
pending,
position,
Expand All @@ -45,7 +45,7 @@ const TimelineItem: React.SFC<TimeLineItemProps> = props => (

return (
<li {...restProps} className={itemClassName}>
{stamp.length === 10 ? <div className={`${prefixCls}-item-stamp`}>{stamp}</div> : null}
{label.length === 10 ? <div className={`${prefixCls}-item-label`}>{label}</div> : null}
<div className={`${prefixCls}-item-tail`} />
<div
className={dotClassName}
Expand All @@ -63,7 +63,7 @@ const TimelineItem: React.SFC<TimeLineItemProps> = props => (
TimelineItem.defaultProps = {
color: 'blue',
pending: false,
stamp: '',
label: '',
position: '',
};

Expand Down
40 changes: 20 additions & 20 deletions components/timeline/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,15 @@ exports[`renders ./components/timeline/demo/right.md correctly 1`] = `
</ul>
`;

exports[`renders ./components/timeline/demo/stamp-left.md correctly 1`] = `
exports[`renders ./components/timeline/demo/label-left.md correctly 1`] = `
<ul
class="ant-timeline ant-timeline-stamp-left"
class="ant-timeline ant-timeline-label-left"
>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-left"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-01
</div>
Expand All @@ -646,10 +646,10 @@ exports[`renders ./components/timeline/demo/stamp-left.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-left"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-02
</div>
Expand All @@ -666,10 +666,10 @@ exports[`renders ./components/timeline/demo/stamp-left.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-left"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-03
</div>
Expand Down Expand Up @@ -710,10 +710,10 @@ exports[`renders ./components/timeline/demo/stamp-left.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item ant-timeline-item-last"
class="ant-timeline-item ant-timeline-item-last ant-timeline-item-label-left"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-04
</div>
Expand All @@ -732,15 +732,15 @@ exports[`renders ./components/timeline/demo/stamp-left.md correctly 1`] = `
</ul>
`;

exports[`renders ./components/timeline/demo/stamp-right.md correctly 1`] = `
exports[`renders ./components/timeline/demo/label-right.md correctly 1`] = `
<ul
class="ant-timeline ant-timeline-stamp-right"
class="ant-timeline ant-timeline-label-right"
>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-right"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-01
</div>
Expand All @@ -757,10 +757,10 @@ exports[`renders ./components/timeline/demo/stamp-right.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-right"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-02
</div>
Expand All @@ -777,10 +777,10 @@ exports[`renders ./components/timeline/demo/stamp-right.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item"
class="ant-timeline-item ant-timeline-item-label-right"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-03
</div>
Expand Down Expand Up @@ -821,10 +821,10 @@ exports[`renders ./components/timeline/demo/stamp-right.md correctly 1`] = `
</div>
</li>
<li
class="ant-timeline-item ant-timeline-item-last"
class="ant-timeline-item ant-timeline-item-last ant-timeline-item-label-right"
>
<div
class="ant-timeline-item-stamp"
class="ant-timeline-item-label"
>
2015-09-04
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
order: 5
title:
zh-CN: 左侧时间戳轴点
en-US: Stamp-left
en-US: Label-left
---

## zh-CN
Expand All @@ -11,25 +11,25 @@ title:

## en-US

Stamp left, content right.
Label left, content right.

```jsx
import { Timeline, Icon } from 'antd';

ReactDOM.render(
<Timeline mode="stamp-left">
<Timeline.Item stamp="2015-09-01">Create a services site</Timeline.Item>
<Timeline.Item stamp="2015-09-02" color="green">
<Timeline mode="label-left">
<Timeline.Item label="2015-09-01">Create a services site</Timeline.Item>
<Timeline.Item label="2015-09-02" color="green">
Solve initial network problems
</Timeline.Item>
<Timeline.Item
stamp="2015-09-03"
label="2015-09-03"
dot={<Icon type="clock-circle-o" style={{ fontSize: '16px' }} />}
color="red"
>
Technical testing
</Timeline.Item>
<Timeline.Item stamp="2015-09-04">Network problems being solved</Timeline.Item>
<Timeline.Item label="2015-09-04">Network problems being solved</Timeline.Item>
</Timeline>,
mountNode,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
order: 5
title:
zh-CN: 右侧时间戳轴点
en-US: Stamp-right
en-US: Label-right
---

## zh-CN
Expand All @@ -11,25 +11,25 @@ title:

## en-US

Stamp right, content left.
Label right, content left.

```jsx
import { Timeline, Icon } from 'antd';

ReactDOM.render(
<Timeline mode="stamp-right">
<Timeline.Item stamp="2015-09-01">Create a services site</Timeline.Item>
<Timeline.Item stamp="2015-09-02" color="green">
<Timeline mode="label-right">
<Timeline.Item label="2015-09-01">Create a services site</Timeline.Item>
<Timeline.Item label="2015-09-02" color="green">
Solve initial network problems
</Timeline.Item>
<Timeline.Item
stamp="2015-09-03"
label="2015-09-03"
dot={<Icon type="clock-circle-o" style={{ fontSize: '16px' }} />}
color="red"
>
Technical testing
</Timeline.Item>
<Timeline.Item stamp="2015-09-04">Network problems being solved</Timeline.Item>
<Timeline.Item label="2015-09-04">Network problems being solved</Timeline.Item>
</Timeline>,
mountNode,
);
Expand Down
4 changes: 2 additions & 2 deletions components/timeline/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Timeline
| pending | Set the last ghost node's existence or its content | boolean\|string\|ReactNode | `false` | |
| pendingDot | Set the dot of the last ghost node when pending is true | string\|ReactNode | `<Icon type="loading" />` | 3.3.0 |
| reverse | reverse nodes or not | boolean | false | 3.5.0 |
| mode | By sending `alternate` the timeline will distribute the nodes to the left and right. | `left` \| `alternate` \| `right` \| `stamp-left` \| `stamp-right` | - | 3.8.0 |
| mode | By sending `alternate` the timeline will distribute the nodes to the left and right. | `left` \| `alternate` \| `right` \| `label-left` \| `label-right` | - | 3.8.0 |

### Timeline.Item

Expand All @@ -42,4 +42,4 @@ Node of timeline
| color | Set the circle's color to `blue`, `red`, `green`, `gray` or other custom colors | string | `blue` | |
| dot | Customize timeline dot | string\|ReactNode | - | |
| position | Customize node position | `left` \| `right` | - | 3.17.0 |
| stamp | Timeline stamp , currently only supported 'yyyy-MM-dd' | string | - | |
| label | Timeline label , currently only supported 'yyyy-MM-dd' | string | - | |
4 changes: 2 additions & 2 deletions components/timeline/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ title: Timeline
| pending | 指定最后一个幽灵节点是否存在或内容 | boolean\|string\|ReactNode | false | |
| pendingDot | 当最后一个幽灵节点存在時,指定其时间图点 | string\|ReactNode | `<Icon type="loading" />` | 3.3.0 |
| reverse | 节点排序 | boolean | false | 3.5.0 |
| mode | 通过设置 `mode` 可以改变时间轴和内容的相对位置 | `left` \| `alternate` \| `right` \| `stamp-left` \| `stamp-right` | - | 3.8.0 |
| mode | 通过设置 `mode` 可以改变时间轴和内容的相对位置 | `left` \| `alternate` \| `right` \| `label-left` \| `label-right` | - | 3.8.0 |

### Timeline.Item

Expand All @@ -43,4 +43,4 @@ title: Timeline
| color | 指定圆圈颜色 `blue, red, green, gray`,或自定义的色值 | string | blue | |
| dot | 自定义时间轴点 | string\|ReactNode | - | |
| position | 自定义节点位置 | `left` \| `right` | - | 3.17.0 |
| stamp | 轴点时间戳,目前仅支持 'yyyy-MM-dd' | string | - | |
| label | 轴点时间戳,目前仅支持 'yyyy-MM-dd' | string | - | |
10 changes: 5 additions & 5 deletions components/timeline/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
font-size: @font-size-base;
list-style: none;

&-stamp {
&-label {
display: none;
}

Expand Down Expand Up @@ -148,10 +148,10 @@
}
}

&.@{timeline-prefix-cls}-stamp-left {
&.@{timeline-prefix-cls}-label-left {
.@{timeline-prefix-cls}-item {
display: flex;
&-stamp {
&-label {
top: -6px;
width: 72px;
position: relative;
Expand All @@ -177,10 +177,10 @@
}
}

&.@{timeline-prefix-cls}-stamp-right {
&.@{timeline-prefix-cls}-label-right {
.@{timeline-prefix-cls}-item {
display: flex;
&-stamp {
&-label {
top: -6px;
left: calc(100% - 72px);
width: 72px;
Expand Down

0 comments on commit f0aac11

Please sign in to comment.