client/src/components/NotesList.js
author ymh <ymh.work@gmail.com>
Tue, 20 Jun 2017 19:05:01 +0200
changeset 66 f402435be429
parent 62 b2514a9bcd49
child 84 bf35a7737f94
permissions -rw-r--r--
Action types cleaning

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;