@csegames/camelot-unchained
Version:
Camelot Unchained Client Library
37 lines (36 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var aphrodite_1 = require("aphrodite");
var Tooltip_1 = require("./Tooltip");
exports.defaultIconButtonStyle = {
IconButton: {
display: 'inline-block',
marginRight: '10px'
},
buttonIcon: {
fontSize: '0.9em',
cursor: 'pointer',
textShadow: '1px 1px rgba(0, 0, 0, 0.7)'
},
disabled: {
cursor: 'not-allowed',
textShadow: '0'
}
};
exports.IconButton = function (props) {
var ss = aphrodite_1.StyleSheet.create(exports.defaultIconButtonStyle);
var custom = aphrodite_1.StyleSheet.create(props.styles || {});
var tooltipContent = props.tooltipContent,
disabled = props.disabled,
iconClass = props.iconClass,
onClick = props.onClick,
color = props.color,
disabledColor = props.disabledColor,
active = props.active,
activeColor = props.activeColor;
return React.createElement("div", { onClick: !disabled ? onClick : null, className: aphrodite_1.css(ss.IconButton, custom.IconButton) }, tooltipContent ? React.createElement(Tooltip_1.default, { content: tooltipContent }, React.createElement("span", { style: {
color: !color ? 'white' : disabled && disabledColor ? disabledColor : active && activeColor ? activeColor : color
}, className: "fa " + iconClass + " " + (!disabled ? 'click-effect' : '') + " " + aphrodite_1.css(ss.buttonIcon, custom.buttonIcon, disabled && ss.disabled, disabled && custom.disabled) })) : React.createElement("span", { style: { color: color }, className: "fa " + iconClass + " " + (!disabled ? 'click-effect' : '') + " " + aphrodite_1.css(ss.buttonIcon, custom.buttonIcon, disabled && ss.disabled, disabled && custom.disabled) }));
};
exports.default = exports.IconButton;