diff -r 5d2bc8c877ea -r 4f4bb2b3ef39 client/src/components/NotesList.js --- a/client/src/components/NotesList.js Wed Aug 15 23:39:02 2018 +0200 +++ b/client/src/components/NotesList.js Thu Aug 16 22:32:36 2018 +0200 @@ -1,15 +1,21 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Immutable from 'immutable'; -import { Modal } from 'react-bootstrap'; +import Modal from 'react-modal'; import Note from './Note'; class NotesList extends Component { - - state = { + constructor(props) { + super(props); + this.state = { editingNote: null, noteToDelete: null, - showModal: false, + modalIsOpen: false, + }; + } + + openModal = () => { + this.setState({modalIsOpen: true}); } enterEditMode = (note) => { @@ -22,7 +28,7 @@ confirmDelete = (note) => { this.setState({ - showModal: true, + modalIsOpen: true, noteToDelete: note }) } @@ -35,11 +41,21 @@ closeModal = () => { this.setState({ - showModal: false, + modalIsOpen: false, noteToDelete: null }) } + handleModalCloseRequest = () => { + // opportunity to validate something and keep the modal open even if it + // requested to be closed + this.setState({ + modalIsOpen: false, + noteToDelete: null + }); + } + + updateNote = (note, data) => { this.props.updateNote(note, data); } @@ -66,14 +82,21 @@ annotationCategories={this.props.annotationCategories} /> )} - - - Êtes vous sûr(e) ? - - - - - + +
+
+ Êtes vous sûr(e) ? +
+
+ + +
+