2020-04-14 05:35:16 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { Icon, Intent } from "@blueprintjs/core";
|
|
|
|
|
import { IconName } from "@blueprintjs/icons";
|
|
|
|
|
import { noop } from "utils/AppsmithUtils";
|
|
|
|
|
export type IconType = IconName | string;
|
|
|
|
|
|
|
|
|
|
class IconComponent extends React.Component<IconComponentProps> {
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<Icon
|
2021-04-28 10:28:39 +00:00
|
|
|
color={this.props.color}
|
2020-04-14 05:35:16 +00:00
|
|
|
icon={this.props.iconName as IconName}
|
|
|
|
|
iconSize={this.props.iconSize}
|
|
|
|
|
intent={this.props.intent}
|
|
|
|
|
onClick={this.props.disabled ? noop : this.props.onClick}
|
2021-04-28 10:28:39 +00:00
|
|
|
style={{
|
|
|
|
|
cursor:
|
|
|
|
|
this.props.onClick && !this.props.disabled ? "pointer" : "auto",
|
|
|
|
|
}}
|
2020-04-14 05:35:16 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IconComponentProps {
|
|
|
|
|
iconSize?: number;
|
|
|
|
|
iconName?: IconType;
|
|
|
|
|
intent?: Intent;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
onClick?: () => void;
|
|
|
|
|
color: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default IconComponent;
|