diff --git a/src/components/captions/CaptionList.js b/src/components/captions/CaptionList.js
index eb0cad7..bbe51d8 100644
--- a/src/components/captions/CaptionList.js
+++ b/src/components/captions/CaptionList.js
@@ -1,16 +1,18 @@
import React from 'react'
const CaptionList = props => {
- const { captions } = props
+ const {togglePopup, captions} = props
return (
{Object.keys(captions).map(key => {
return captions[key].map(caption => {
return (
+ onClick={() => {
+ togglePopup({ nick: caption.nick, text: caption.text })
console.log({ nick: caption.nick, text: caption.text })
}
+ }
>
{caption.nick} |
{caption.text} |
diff --git a/src/components/captions/Captions.js b/src/components/captions/Captions.js
index a601356..12e0311 100644
--- a/src/components/captions/Captions.js
+++ b/src/components/captions/Captions.js
@@ -2,24 +2,94 @@ import React from 'react'
import CaptionList from './CaptionList'
import Table from 'react-bootstrap/Table'
import {connect} from 'react-redux'
-const Captions = props => {
+import {Card, Form, Row, Col, Button} from 'react-bootstrap'
- const captions = props.captions.all.find(captionSet=>captionSet.slug===props.match.params.slug)
-
- if(!captions) return No show with that id.
+// const Popup = props => {
+// return (
+//
+//
+//
+// Edit Comment
+// {props.text ? props.text : 'no comment.'}
+//
+//
+//
+//
+// )
+// }
+const Popup = props => {
return (
-
-
-
- Nick |
- Comment |
-
-
-
-
+
+
+
+
+ {props.slug}
+
+
+ Nick
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
}
+class Captions extends React.Component {
+ constructor() {
+ super()
+ this.state = {showPopup: false}
+ this.togglePopup = this.togglePopup.bind(this)
+ }
+
+ togglePopup(comment) {
+ console.log('toggling popup!')
+ this.setState({
+ showPopup: !this.state.showPopup,
+ nick: comment.nick,
+ text: comment.text
+
+ })
+ }
+
+
+ render() {
+ const captions = this.props.captions.all.find(captionSet=>captionSet.slug===this.props.match.params.slug)
+ if(!captions) return No show with that id.
+ return (
+
+ {this.state.showPopup ?
+
+ : null
+ }
+
+
+
+ Nick |
+ Comment |
+
+
+
+
+
+
+ )
+ }}
const mapState = state => {
return {
@@ -28,4 +98,6 @@ const mapState = state => {
}
}
+
+
export default connect(mapState)(Captions)