This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/frontend/components/Alert/Alert.js
Jori Lallo 8b3b3222b7 Swapped Flex to homegrown component
No more element prop warnings!
2017-07-07 00:04:12 -07:00

37 lines
852 B
JavaScript

// @flow
import React, { PropTypes } from 'react';
import Flex from 'components/Flex';
import classNames from 'classnames/bind';
import styles from './Alert.scss';
const cx = classNames.bind(styles);
class Alert extends React.Component {
static propTypes = {
children: PropTypes.node.isRequired,
danger: PropTypes.bool,
warning: PropTypes.bool,
success: PropTypes.bool,
};
render() {
let alertType;
if (this.props.danger) alertType = 'danger';
if (this.props.warning) alertType = 'warning';
if (this.props.success) alertType = 'success';
if (!alertType) alertType = 'info'; // default
return (
<Flex
align="center"
justify="center"
className={cx(styles.container, styles[alertType])}
>
{this.props.children}
</Flex>
);
}
}
export default Alert;