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

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-05-22 12:41:39 +02:00
import React, { Component } from 'react';
import FlatButton from 'material-ui/FlatButton';
import Dialog from './draggable-dialog';
2018-05-23 04:48:57 +02:00
import './draggable-dialog/css/index.css';
2018-05-22 12:41:39 +02:00
const defaultDialogHeight = 100; //px
const dialogHeightPerLine = 25; //px
2018-05-22 12:41:39 +02:00
export class ValidationErrorsInfoDialog extends React.Component {
state = {
2018-05-22 12:41:39 +02:00
open: this.props.open,
}
componentWillReceiveProps(newProps){
this.setState({open: newProps.open});
}
handleOpen = () => {
this.setState({ open: true });
};
handleClose = () => {
this.setState({ open: false });
this.props.onDismiss();
};
render() {
2018-05-23 04:48:57 +02:00
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 => {
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
const oneValidationMessageWithTab = (<span><li style={{ marginLeft: 2 + "em" }}>{errorMessage.message}</li></span>);
if (errorMessage.field_name === "password-tab") {
return oneValidationMessageWithTab;
} else {
return oneValidationMessage;
2018-05-23 04:48:57 +02:00
}
})}
</Dialog>
</div>
);
2018-05-22 12:41:39 +02:00
}
2018-05-28 16:12:02 +02:00
}
2018-05-22 12:41:39 +02:00
2018-05-28 16:12:02 +02:00
module.exports = ValidationErrorsInfoDialog;