@nomios/web-uikit
Version:
Nomios' living web UIKit
44 lines (38 loc) • 1.33 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { RemoveIcon } from '../icon';
import styles from './BoxedStar.css';
class BoxedStar extends Component {
constructor(...args) {
super(...args);
_defineProperty(this, "handleRemove", event => this.props.onRemove(event, this.props.id));
}
render() {
const {
children,
onRemove,
className,
contentClassName,
removeClassName
} = this.props;
return React.createElement("div", {
className: classNames(styles.container, className)
}, onRemove && React.createElement(RemoveIcon, {
className: classNames(styles.remove, removeClassName),
onClick: this.handleRemove
}), React.createElement("div", {
className: classNames(styles.content, contentClassName)
}, children));
}
}
BoxedStar.propTypes = {
children: PropTypes.node,
onRemove: PropTypes.func,
id: PropTypes.string,
className: PropTypes.string,
contentClassName: PropTypes.string,
removeClassName: PropTypes.string
};
export default BoxedStar;