mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
23 lines
575 B
TypeScript
Executable File
23 lines
575 B
TypeScript
Executable File
import * as React from 'react';
|
|
import classNames from 'classnames';
|
|
import omit from 'omit.js';
|
|
|
|
export interface IconProps {
|
|
type: string;
|
|
className?: string;
|
|
title?: string;
|
|
onClick?: React.MouseEventHandler<any>;
|
|
spin?: boolean;
|
|
}
|
|
|
|
export default (props: IconProps) => {
|
|
const { type, className = '', spin } = props;
|
|
const classString = classNames({
|
|
anticon: true,
|
|
'anticon-spin': !!spin || type === 'loading',
|
|
[`anticon-${type}`]: true,
|
|
[className]: true,
|
|
});
|
|
return <i {...omit(props, ['type', 'spin'])} className={classString} />;
|
|
};
|