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.
outline/app/components/Alert/Alert.js

38 lines
772 B
JavaScript

// @flow
import React from 'react';
import { observer } from 'mobx-react';
import Flex from 'components/Flex';
import styled from 'styled-components';
import { color } from 'shared/styles/constants';
type Props = {
children: React.Element<*>,
type?: 'info' | 'success' | 'warning' | 'danger' | 'offline',
};
@observer class Alert extends React.Component {
props: Props;
defaultProps = {
type: 'info',
};
render() {
return (
<Container align="center" justify="center" type={this.props.type}>
{this.props.children}
</Container>
);
}
}
const Container = styled(Flex)`
height: $headerHeight;
color: #ffffff;
font-size: 14px;
line-height: 1;
background-color: ${({ type }) => color[type]};
`;
export default Alert;