client/src/components/NotesList.js
author Alexandre Segura <mex.zktk@gmail.com>
Tue, 06 Jun 2017 15:56:41 +0200
changeset 19 f1b125b95fe9
parent 18 dab2a16500e0
child 29 4cfeabef7d5e
permissions -rw-r--r--
Introduce "annotation" plugin. - Wrap mark around text. - Store selected text in mark data. - Colorize selected text.

import React from 'react';

import PropTypes from 'prop-types';
import Immutable from 'immutable';

import { Alert } from 'react-bootstrap';

import Note from './Note';

const NotesList = ({notes}) => {

  if (notes.size === 0) {
    return (
      <Alert bsStyle="warning">No notes yet. Add notes with the textarea below.</Alert>
    );
  }

  return (
    <div>
      {notes.map((note) =>
        <Note note={note} key={note.id} />
      )}
    </div>
  );
};

NotesList.propTypes = {
  notes: PropTypes.instanceOf(Immutable.List).isRequired
};

export default NotesList;