client/src/components/NotesList.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 01 Jun 2017 19:01:03 +0200
changeset 18 dab2a16500e0
parent 12 48ddaa42b810
child 19 f1b125b95fe9
permissions -rw-r--r--
Add some styles for note timings.

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 (
    <div>
      {notes.map((note) =>
        <Note note={note} />
      )}
    </div>
  );
};

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

export default NotesList;