Skip to content

Commit

Permalink
chore(Timeline): fix cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
eternalsky committed Jan 31, 2024
1 parent 110d4ed commit aebcacd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 57 deletions.
12 changes: 4 additions & 8 deletions components/timeline/__docs__/demo/fold/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ import { Timeline, Select } from '@alifd/next';

const TimelineItem = Timeline.Item;

class Demo extends React.Component<any, { timelineAnimation: boolean }> {
constructor(props: any) {
super(props);

this.state = {
timelineAnimation: true,
};
}
class Demo extends React.Component {
state = {
timelineAnimation: true,
};

onTimelineAnimation = (value: boolean) => {
this.setState({ timelineAnimation: value });
Expand Down
14 changes: 6 additions & 8 deletions components/timeline/__docs__/demo/mode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { Timeline, Select } from '@alifd/next';

const TimelineItem = Timeline.Item;

class Demo extends React.Component<any, any> {
constructor(props: any) {
super(props);

this.state = {
mode: 'alternate',
};
}
class Demo extends React.Component {
state: {
mode: 'alternate' | 'left';
} = {
mode: 'alternate',
};

onTimelineMode = (value: string) => {
this.setState({ mode: value });
Expand Down
1 change: 0 additions & 1 deletion components/timeline/__tests__/index-spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Timeline', () => {
});

it('should render a timeline with timeLeft', () => {
// 涉及到子组件的渲染,不能用 shallow,改用 mount
cy.mount(
<Timeline>
<Item timeLeft="2017-10-23" content="2016-10-03" state="process" title="签收" />
Expand Down
6 changes: 3 additions & 3 deletions components/timeline/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ItemProps extends Omit<HTMLAttributesWeak, 'content' | 'title'>
/**
* 节点状态
* @en node state
* @defaultValue done
* @defaultValue 'done'
*/
state?: 'done' | 'process' | 'error' | 'success';

Expand Down Expand Up @@ -60,7 +60,7 @@ export interface ItemProps extends Omit<HTMLAttributesWeak, 'content' | 'title'>
/**
* 展示的模式,left 为左,alternate 为交替显示
* @en show mode
* @defaultValue left
* @defaultValue 'left'
* @version 1.23.18
*/
mode?: 'left' | 'alternate';
Expand Down Expand Up @@ -121,7 +121,7 @@ export interface TimelineProps extends React.HTMLAttributes<HTMLElement>, Common
/**
* 展示的模式,left 为左,alternate 为交替显示
* @en show mode
* @defaultValue left
* @defaultValue 'left'
* @version 1.23.18
*/
mode?: 'left' | 'alternate';
Expand Down
24 changes: 0 additions & 24 deletions components/timeline/view/timeline-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,16 @@ class TimelineItem extends Component<ItemProps> {
total: PropTypes.number,
folderIndex: PropTypes.number,
foldShow: PropTypes.bool,
/**
* 节点状态
*/
state: PropTypes.oneOf(['done', 'process', 'error', 'success']),
/**
* 图标
*/
icon: PropTypes.string,
/**
* 自定义时间轴节点
*/
dot: PropTypes.node,
/**
* 格式化后的时间
*/
time: PropTypes.node,
/**
* 标题
*/
title: PropTypes.node,
/**
* 左侧时间
*/
timeLeft: PropTypes.node,
/**
* 右侧内容
*/
content: PropTypes.node,
toggleFold: PropTypes.func,
className: PropTypes.string,
locale: PropTypes.object,
/**
* 动画
*/
animation: PropTypes.bool,
};

Expand Down
13 changes: 0 additions & 13 deletions components/timeline/view/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,13 @@ class Timeline extends Component<TimelineProps, TimelineState> {
static Item = Item;
static propTypes = {
...ConfigProvider.propTypes,
/**
* 样式的品牌前缀
*/
prefix: PropTypes.string,
rtl: PropTypes.bool,
/**
* 自定义折叠选项 示例`[{foldArea: [startIndex, endIndex], foldShow: boolean}]`
*/
fold: PropTypes.array,
/**
* 自定义类名
*/
className: PropTypes.string,
children: PropTypes.any,
locale: PropTypes.object,
animation: PropTypes.bool,
/**
* 展示的模式
* @version 1.23.18
*/
mode: PropTypes.oneOf(['left', 'alternate']),
};

Expand Down

0 comments on commit aebcacd

Please sign in to comment.