Remove onClick option from Icon.tsx

This commit is contained in:
Florian Scholdei
2020-04-20 00:44:52 +02:00
parent 0a7c847c56
commit 3ab3eb43bd
3 changed files with 5 additions and 20 deletions

View File

@@ -32,10 +32,6 @@ const Wrapper = styled.div`
}
`;
const helloWorld = () => {
alert("Hello world!");
};
const colors = ["primary", "link", "info", "success", "warning", "danger", "white", "light", "dark", "black", "text"];
const sizing = ["xs", "sm", "lg", "2x", "3x", "5x", "7x", "10x"];
@@ -77,11 +73,6 @@ storiesOf("Icon", module)
<Icon title="rotate-270" name="snowboarding fa-rotate-270" />
<Icon title="spin" name="spinner fa-spin" />
<Icon title="custom sizing" name="cat" className="is-size-4" />
<Icon
title="custom background and onClick"
name="hand-sparkles"
className="has-background-primary-25"
onClick={() => helloWorld()}
/>
<Icon title="custom background" name="hand-sparkles" className="has-background-primary-25" />
</>
));

View File

@@ -30,7 +30,6 @@ type Props = {
name: string;
color: string;
className?: string;
onClick?: () => void;
};
export default class Icon extends React.Component<Props> {
@@ -40,16 +39,12 @@ export default class Icon extends React.Component<Props> {
};
render() {
const { title, iconStyle, name, color, className, onClick } = this.props;
const { title, iconStyle, name, color, className } = this.props;
if (title) {
return (
<i
title={title}
className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)}
onClick={onClick}
/>
<i title={title} className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)} />
);
}
return <i className={classNames(iconStyle, "fa-" + name, `has-text-${color}`, className)} onClick={onClick} />;
return <i className={classNames(iconStyle, "fa-" + name, `has-text-${color}`, className)} />;
}
}

View File

@@ -32820,8 +32820,7 @@ exports[`Storyshots Icon More options 1`] = `
/>
<i
className="fas fa-fw fa-hand-sparkles has-text-grey-light has-background-primary-25"
onClick={[Function]}
title="custom background and onClick"
title="custom background"
/>
</div>
`;