mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-23 20:07:40 +02:00
29 lines
773 B
JavaScript
29 lines
773 B
JavaScript
import Snackbar from 'react-toolbox/lib/snackbar';
|
|
import React, { PropTypes } from 'react';
|
|
|
|
class ErrorComponent extends React.Component {
|
|
static propTypes () {
|
|
return {
|
|
errors: PropTypes.array.isRequired,
|
|
muteError: PropTypes.func.isRequired,
|
|
};
|
|
}
|
|
|
|
render () {
|
|
const showError = this.props.errors.length > 0;
|
|
const error = showError ? this.props.errors[0] : undefined;
|
|
return (
|
|
<Snackbar
|
|
action="Dismiss"
|
|
active={showError}
|
|
icon="question_answer"
|
|
label={error}
|
|
onClick={() => this.props.muteError(error)}
|
|
type="warning"
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default ErrorComponent;
|