client/src/components/NotesList.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 08 Jun 2017 18:54:36 +0200
changeset 25 e04714a1d4eb
parent 19 f1b125b95fe9
child 29 4cfeabef7d5e
permissions -rw-r--r--
Improve categories tooltip. - Manage categories with comment enabled. - Rename mark type to "category". - Simplify code, use only one mark type.

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;