mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
chore: make < TimelineItem /> a bit lighter, drop unneeded omit.js and defaultProps (#27961)
This commit is contained in:
parent
41a6c655bf
commit
683eec118b
@ -1,6 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
|
||||
export interface TimelineItemProps {
|
||||
@ -20,18 +19,18 @@ export interface TimeLineItemProps extends TimelineItemProps {
|
||||
__deprecated_do_not_use_it__?: any; // eslint-disable-line camelcase
|
||||
}
|
||||
|
||||
const TimelineItem: React.FC<TimelineItemProps> = props => {
|
||||
const TimelineItem: React.FC<TimelineItemProps> = ({
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
color = 'blue',
|
||||
dot,
|
||||
pending = false,
|
||||
position, /** dead, but do not pass in <li {...omit()} */
|
||||
label,
|
||||
children,
|
||||
...restProps
|
||||
}) => {
|
||||
const { getPrefixCls } = React.useContext(ConfigContext);
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
color,
|
||||
children,
|
||||
pending,
|
||||
dot,
|
||||
label,
|
||||
...restProps
|
||||
} = props;
|
||||
|
||||
const prefixCls = getPrefixCls('timeline', customizePrefixCls);
|
||||
const itemClassName = classNames(
|
||||
@ -49,7 +48,7 @@ const TimelineItem: React.FC<TimelineItemProps> = props => {
|
||||
});
|
||||
|
||||
return (
|
||||
<li {...omit(restProps, ['position'])} className={itemClassName}>
|
||||
<li {...restProps} className={itemClassName}>
|
||||
{label && <div className={`${prefixCls}-item-label`}>{label}</div>}
|
||||
<div className={`${prefixCls}-item-tail`} />
|
||||
<div
|
||||
@ -63,10 +62,4 @@ const TimelineItem: React.FC<TimelineItemProps> = props => {
|
||||
);
|
||||
};
|
||||
|
||||
TimelineItem.defaultProps = {
|
||||
color: 'blue',
|
||||
pending: false,
|
||||
position: '',
|
||||
};
|
||||
|
||||
export default TimelineItem;
|
||||
|
Loading…
Reference in New Issue
Block a user