Skip to content

Commit b9fed09

Browse files
wewoormumiao
authored andcommitted
feat(icon): add onClick prop in Icon
1 parent f5c24b3 commit b9fed09

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/icon/index.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import { classNames, prefixClaName } from 'mo/common/className';
22
import * as React from 'react';
33
import 'vscode-codicons/dist/codicon.css';
4-
export interface IIcon {
4+
5+
export interface IIcon extends HTMLElementProps {
56
type: string;
6-
className?: string;
7+
onClick?: (e: React.MouseEvent) => void;
78
}
89

9-
export function Icon(props: IIcon) {
10-
const { className, type, ...others } = props;
10+
export function Icon(props: IIcon): React.ReactElement {
11+
const { className, type, ...restProps } = props;
1112
return (
1213
<span
1314
className={classNames(
1415
className,
1516
'codicon',
1617
prefixClaName(type, 'codicon')
1718
)}
18-
{...others}
19+
{...restProps}
1920
></span>
2021
);
2122
}

0 commit comments

Comments
 (0)