add onClick prop

This commit is contained in:
Florian Scholdei
2019-09-16 19:18:14 +02:00
parent 7dcc91a610
commit fb8f7fefd2

View File

@@ -7,7 +7,8 @@ type Props = {
color?: string, color?: string,
icon?: string, icon?: string,
label: string, label: string,
title?: string title?: string,
onClick?: () => void
}; };
class Tag extends React.Component<Props> { class Tag extends React.Component<Props> {
@@ -16,7 +17,7 @@ class Tag extends React.Component<Props> {
}; };
render() { render() {
const { icon, label, title, color, className } = this.props; const { className, color, icon, label, title, onClick } = this.props;
let showIcon = null; let showIcon = null;
if (icon) { if (icon) {
showIcon = ( showIcon = (
@@ -30,6 +31,7 @@ class Tag extends React.Component<Props> {
<span <span
className={classNames("tag", `is-${color}`, className)} className={classNames("tag", `is-${color}`, className)}
title={title} title={title}
onClick={onClick}
> >
{showIcon} {showIcon}
{label} {label}