Skip to content

Commit

Permalink
feat(icon): add onClick prop in Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor authored and mumiao committed Mar 16, 2021
1 parent f5c24b3 commit b9fed09
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { classNames, prefixClaName } from 'mo/common/className';
import * as React from 'react';
import 'vscode-codicons/dist/codicon.css';
export interface IIcon {

export interface IIcon extends HTMLElementProps {
type: string;
className?: string;
onClick?: (e: React.MouseEvent) => void;
}

export function Icon(props: IIcon) {
const { className, type, ...others } = props;
export function Icon(props: IIcon): React.ReactElement {
const { className, type, ...restProps } = props;
return (
<span
className={classNames(
className,
'codicon',
prefixClaName(type, 'codicon')
)}
{...others}
{...restProps}
></span>
);
}

0 comments on commit b9fed09

Please sign in to comment.