From eb61620b2cbf39442e39d234a770ec269acb4804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chif=20Gerg=C5=91?= <chifgeri97@gmail.com> Date: Thu, 17 Jan 2019 17:33:46 +0100 Subject: [PATCH] Notes shown in popup to not break the table --- src/components/pages/EventDetail.js | 63 ++++++++++++++++------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/components/pages/EventDetail.js b/src/components/pages/EventDetail.js index 530ed73..685697d 100644 --- a/src/components/pages/EventDetail.js +++ b/src/components/pages/EventDetail.js @@ -9,6 +9,7 @@ import { Table, Icon, Checkbox, + Popup, } from 'semantic-ui-react'; import { connect } from 'react-redux'; import moment from 'moment'; @@ -56,20 +57,24 @@ class EventDetail extends Component { </Table.Cell> } <Table.Cell> - {this.props.eventNotes.map((note) => { - if (note.profile === item.id) { - return ( - <Comment.Content> - <Comment.Author>{note.created_by_name}</Comment.Author> - <Comment.Text> - {note.note} - </Comment.Text> - </Comment.Content> - ); - } - return (''); - }) - } + <Popup + trigger={<Button icon='add' />} + content={this.props.eventNotes.map((note) => { + if (note.profile === item.id) { + return ( + <Comment.Content> + <Comment.Author>{note.created_by_name}</Comment.Author> + <Comment.Text> + {note.note} + </Comment.Text> + </Comment.Content> + ); + } + return (''); + }) + } + basic + /> </Table.Cell> </Table.Row> ); @@ -88,19 +93,23 @@ class EventDetail extends Component { renderComments() { const notes = this.props.eventNotes; - return notes.map(note => ( - <Comment> - <Comment.Content> - <Comment.Author>{note.created_by_name}</Comment.Author> - <Comment.Metadata> - {moment(note.created_at).format('LL')} - </Comment.Metadata> - <Comment.Text> - {note.note} - </Comment.Text> - </Comment.Content> - </Comment> - )); + return notes.map((note) => { + if (!note.profile) { + return ( + <Comment> + <Comment.Content> + <Comment.Author>{note.created_by_name}</Comment.Author> + <Comment.Metadata> + {moment(note.created_at).format('LL')} + </Comment.Metadata> + <Comment.Text> + {note.note} + </Comment.Text> + </Comment.Content> + </Comment>); + } + return ''; + }); } render() { -- GitLab