client/src/components/SessionSummary.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 22 Jun 2017 11:58:27 +0200
changeset 73 7e8cdc74d86f
parent 63 4088f8dc6b52
child 74 043477fd5c5c
permissions -rw-r--r--
Make session summary scrollable.

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Panel, ListGroup, ListGroupItem } from 'react-bootstrap';
import _ from 'lodash';
import '../App.css';

class SessionSummary extends Component {
  render() {
    return (
      <ListGroup>
        {this.props.notes.map((note) =>
          <ListGroupItem key={note.get('_id')}>
            <a href={'#note-' + note.get('_id')}>
              <span className="text-muted">{note.startedAt}  {note.finishedAt}</span>
              <span className="pull-right">{_.words(note.plain).length} words</span>
            </a>
          </ListGroupItem>
        )}
      </ListGroup>
    );
  }
}

function mapStateToProps(state, props) {
  return props;
}

export default connect(mapStateToProps)(SessionSummary);