client/src/components/NotesList.js
author Alexandre Segura <mex.zktk@gmail.com>
Mon, 19 Jun 2017 15:36:52 +0200
changeset 52 96f8a4a59bd9
parent 29 4cfeabef7d5e
child 58 f16a080e0bc4
permissions -rw-r--r--
Implement logout.

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;