revenge-react-components
Version:
react-components for revenge https://github.com/buildo/revenge
34 lines (28 loc) • 627 B
JavaScript
import React from 'react';
import { pure, skinnable, props, t } from 'revenge';
import cx from 'classnames';
()
({
icon: t.maybe(t.Str),
className: t.maybe(t.Str),
style: t.maybe(t.Obj),
onClick: t.maybe(t.Func)
})
export default class Icon extends React.Component {
static defaultProps = {
className: '',
style: {},
onClick: () => {}
}
getLocals() {
return {
...this.props
};
}
template({ icon, className, style, onClick }) {
return icon ?
<i className={cx('icon', `icon-${icon}`, className)} style={style} onClick={onClick}/>
: null;
}
}