From 30fb4a2f44d8e197f2eafcf5ddb1f1930e06929b Mon Sep 17 00:00:00 2001 From: jessicagallagher Date: Wed, 17 Mar 2021 01:07:51 -0400 Subject: [PATCH] started styling show page, created explore component --- src/components/Event.jsx | 84 ++++++++++++++++++++---------------- src/components/EventCard.jsx | 22 ++++++++++ src/components/Explore.jsx | 0 3 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 src/components/Explore.jsx diff --git a/src/components/Event.jsx b/src/components/Event.jsx index 5dae729..ffe8ae3 100644 --- a/src/components/Event.jsx +++ b/src/components/Event.jsx @@ -3,44 +3,56 @@ import React, { Component } from 'react' let baseURL = '' -if (process.env.NODE_ENV === 'development') { - baseURL = 'http://localhost:3003' +if(process.env.NODE_ENV === 'development') { + baseURL = 'http://localhost:3003' } else { - baseURL = 'heroku backend url here' + baseURL = 'heroku backend url here' } export default class Event extends Component { - constructor(props) { - super(props) - this.state = { - event: { - creator: '', - title: '', - date: '', - category: '', - description: '' - } - } - - } - - componentDidMount() { - console.log(this.props.match.params.id) - axios.get(`${baseURL}/events/${this.props.match.params.id}`) - .then(response => { - this.setState({ event: response.data }) - }) - } - - render() { - return ( -
-

{ this.state.event.Title }

-

Creator: { this.state.event.Creator }

-

Date: { this.state.event.Date }

-

Category: { this.state.event.Category }

-

Description: { this.state.event.Description }

+ constructor(props) { + super(props) + this.state = { + event: { + creator: '', + title: '', + date: '', + category: '', + description: '' + } + + } + + } + + componentDidMount() { + console.log(this.props.match.params.id) + axios.get(`${baseURL}/events/${this.props.match.params.id}`) + .then(response => { + this.setState({ event: response.data }) + }) + } + + render() { + return ( +
+

Get the Deets

+
+
+
+
+
{ this.state.event.Title }
+

Added By: { this.state.event.Creator }

+

Date(s): { this.state.event.Date }

+

{ this.state.event.Category }

+

Description: { this.state.event.Description }

- ) - } -} + +
+ +
+ +
+ ) + } +} \ No newline at end of file diff --git a/src/components/EventCard.jsx b/src/components/EventCard.jsx index 934c32a..52c4c41 100644 --- a/src/components/EventCard.jsx +++ b/src/components/EventCard.jsx @@ -18,8 +18,11 @@ export default class EventCard extends Component { this.state = { events: [] } + // this.findCategory = this.findCategory.bind(this) } + + deleteEvent(id) { console.log('deleting a bookmark') @@ -33,6 +36,20 @@ export default class EventCard extends Component { }) } + // findCategory() { + // const categoryType = this.state.event.Category + // let p; + // + // if(categoryType === 'Nature') { + // p =

+ // } + // if(categoryType === 'Night-out') { + // p =

+ // } else { + // p =

+ // } + // } + render() { return (
@@ -48,6 +65,11 @@ export default class EventCard extends Component {

Date(s): { event.Date }

{/* */} this.deleteEvent(event._id)}> + {/* { this.findCategory(event => { + return ( + p + { event.Category } + ) + }) } */}

{ event.Category }

) diff --git a/src/components/Explore.jsx b/src/components/Explore.jsx new file mode 100644 index 0000000..e69de29