mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 06:58:33 +08:00
25 lines
609 B
TypeScript
Executable File
25 lines
609 B
TypeScript
Executable File
import 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;
|
|
style?: React.CSSProperties;
|
|
}
|
|
|
|
const Icon = (props: IconProps) => {
|
|
const { type, className = '', spin } = props;
|
|
const classString = classNames({
|
|
anticon: true,
|
|
'anticon-spin': !!spin || type === 'loading',
|
|
[`anticon-${type}`]: true,
|
|
}, className);
|
|
return <i {...omit(props, ['type', 'spin'])} className={classString} />;
|
|
};
|
|
|
|
export default Icon;
|