client/src/components/NotesList.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 01 Jun 2017 17:32:07 +0200
changeset 16 e67cd18cc594
parent 12 48ddaa42b810
child 18 dab2a16500e0
permissions -rw-r--r--
Draft implementation of note timing.

import React from 'react';

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

import { ListGroup, ListGroupItem, 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 (
    <ListGroup>
      {notes.map((note) =>
        <ListGroupItem key={note.id}><Note note={note} /></ListGroupItem>
      )}
    </ListGroup>
  );
};

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

export default NotesList;