fleet/frontend/components/modals/Modal/Modal.jsx
noahtalerman 49e71e4ed6
Add new icons for Hosts page. Fix hosts list width on wide screens. (#128)
- Add new PNG files for the new icons in the left side navigation and the right side labels on the Hosts page.
- Rename the old `<Icon />` component to `<KolideIcon />` and create a new `<Icon />` component. The ultimate goal is to get rid of the `<KolideIcon />` and `<PlatformIcon />` components and use the encompassing `<Icon />` component for all icons. The full transition will be made when we have icon assets to replace all the kolide icons and platform icons. Currently, we don't.
- Rename the `icon_name_for_label.js` utility to `icon_name.js` because the utility now includes `iconNameForLabel()` and `iconNameForPlatform()` functions.
- Fixes issue #127.
2020-12-14 18:24:16 -08:00

41 lines
1.1 KiB
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import KolideIcon from 'components/icons/KolideIcon';
const baseClass = 'modal';
class Modal extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
onExit: PropTypes.func,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
};
render () {
const { children, className, onExit, title } = this.props;
const modalContainerClassName = classnames(`${baseClass}__modal_container`, className);
return (
<div className={`${baseClass}__background`}>
<div className={modalContainerClassName}>
<div className={`${baseClass}__header`}>
<span>{title}</span>
<div className={`${baseClass}__ex`}>
<button className="button button--unstyled" onClick={onExit}>
<KolideIcon name="x" />
</button>
</div>
</div>
<div className={`${baseClass}__content`}>
{children}
</div>
</div>
</div>
);
}
}
export default Modal;