Files
old-svijetlastrana-front/src/components/Shared/ValidationErrorsInfoDialog.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-05-22 12:41:39 +02:00
import React, { Component } from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
export class ValidationErrorsInfoDialog extends React.Component {
2018-05-25 09:10:32 +02:00
constructor(props) {
super(props)
this.props = props;
this.state = {
2018-05-22 12:41:39 +02:00
open: this.props.open,
}
}
2018-05-25 09:10:32 +02:00
componentWillReceiveProps(newProps) {
this.setState({ open: newProps.open });
}
handleOpen = () => {
this.setState({ open: true });
};
handleClose = () => {
this.setState({ open: false });
this.props.onDismiss();
};
render() {
const actions = [
<FlatButton
label="Dismiss"
primary={true}
keyboardFocused={true}
onClick={this.handleClose}
/>,
];
return (
<div>
<Dialog
title="Errors"
actions={actions}
modal={this.props.modal ? this.props.modal : false}
open={this.state.open}
onRequestClose={this.handleClose}
overlayStyle={{ backgroundColor: 'transparent' }}
>
{this.props.errorMessages.map(errorMessage => {
return (
<div>
<a>{errorMessage.message}</a>
<br />
</div>
);
})}
</Dialog>
</div>
);
}
}
module.exports = ValidationErrorsInfoDialog;