From 58cda9cc7fb79ca9df6746de7f9662bc08dc156a Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 13 Oct 2017 12:29:40 +0200 Subject: initial commit --- src/components/ui/Infobox.js | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/components/ui/Infobox.js (limited to 'src/components/ui/Infobox.js') diff --git a/src/components/ui/Infobox.js b/src/components/ui/Infobox.js new file mode 100644 index 000000000..2d063c7ef --- /dev/null +++ b/src/components/ui/Infobox.js @@ -0,0 +1,87 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { observer } from 'mobx-react'; +import classnames from 'classnames'; +import Loader from 'react-loader'; + +@observer +export default class Infobox extends Component { + static propTypes = { + children: PropTypes.any.isRequired, // eslint-disable-line + icon: PropTypes.string, + type: PropTypes.string, + ctaOnClick: PropTypes.func, + ctaLabel: PropTypes.string, + ctaLoading: PropTypes.bool, + dismissable: PropTypes.bool, + }; + + static defaultProps = { + icon: '', + type: 'primary', + dismissable: false, + ctaOnClick: () => null, + ctaLabel: '', + ctaLoading: false, + }; + + state = { + dismissed: false, + }; + + render() { + const { + children, + icon, + type, + ctaLabel, + ctaLoading, + ctaOnClick, + dismissable, + } = this.props; + + if (this.state.dismissed) { + return null; + } + + return ( +
+ {icon && ( + + )} +
+ {children} +
+ {ctaLabel && ( + + )} + {dismissable && ( +
+ ); + } +} -- cgit v1.2.3-70-g09d2