From 097213bff762f00ea6bfe5b1743454fa34925a9b Mon Sep 17 00:00:00 2001 From: Madeline Hart Date: Tue, 29 Dec 2020 15:20:07 +0000 Subject: [PATCH] Add Events Section (cont'd) --- frontend/src/App.css | 15 +++++++- frontend/src/App.tsx | 53 ++++++++++++++------------ frontend/src/components/EventRow.tsx | 39 +++++++++++++++++++ frontend/src/components/EventsList.tsx | 23 +++++++++++ 4 files changed, 105 insertions(+), 25 deletions(-) create mode 100644 frontend/src/components/EventRow.tsx create mode 100644 frontend/src/components/EventsList.tsx diff --git a/frontend/src/App.css b/frontend/src/App.css index a41ca7e2..826f6876 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -86,8 +86,14 @@ body { display: inline-flex; } +.isitweeka h5 { + font-size: 1em; + display: inline-flex; +} + .isitweeka a { color: #00B0FF; + display: inline-flex; } .events * { @@ -120,7 +126,8 @@ button { } button.forward { - margin: 0 auto; + /*margin-right: auto;*/ + /*margin-left: -8px;*/ width: auto; } @@ -215,6 +222,12 @@ button.back::after { padding: 0 5vw; } +.events-row:first-child { + border-top-style: solid; + border-top-width: 1px; + border-top-color: var(--link-active); +} + :root { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0a9006a5..64843a3b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,6 +3,8 @@ import gaSetState, { GA_DISABLE_COOKIE_STR, GA_PROPERTY } from "./gAnalytics"; import './App.css'; import CookieConsent from 'react-cookie-consent'; import { Navbar } from "react-bootstrap"; +import EventRow from "./components/EventRow"; +import { dummyResponse, EventData } from "./components/EventsList"; /*function App() { return ( @@ -46,6 +48,7 @@ interface TheState { /** Tells page when API has ran (i.e. page loaded) */ apiHasRan: boolean; isWeekend: boolean; + eventData: EventData; } class App extends Component<{}, TheState> { @@ -58,13 +61,24 @@ class App extends Component<{}, TheState> { week: "unknown", apiHasRan : false, isWeekend: false, + eventData: { + events: [], + generatedAt: 0, + } } } componentDidMount() { this.loadGoogleAPI(); + this.fetchEvents(); } + async fetchEvents() { + this.setState({ + eventData: dummyResponse, + }); + }; + /** * Loads the Google API, then runs {@link getCalendar} */ @@ -213,9 +227,9 @@ class App extends Component<{}, TheState> { if (this.state.isNotWeekAB || this.state.week === "unknown") { return ( <> -

It is neither Week A or B.

+

It is neither Week A nor B.

This means it's probably a holiday.

- +
If you believe this is in error, please email info@isitweeka.com
) @@ -225,7 +239,7 @@ class App extends Component<{}, TheState> {

{this.state.isWeekend ? "Next week will be" : "It is"}

{/* Special case for weekend, where we show next week*/}

Week {this.state.week}

More coming soon...

- + ) } @@ -262,27 +276,18 @@ class App extends Component<{}, TheState> {

-
-
-
- {/*

[IMAGE SET AS BACKGROUND OF THIS DIV]

*/} -
-
-
-

Would I Lie To You?

- -

On sale now!

-
-
-
-
-

[IMAGE SET AS BACKGROUND OF THIS DIV]

-
-
-

Event Number Two?

-

Tickets on sale 03/02/21

-
-
+ {this.state.eventData.events.map(({ title, headerURL, backgroundColor }) => ( + + ))} + {/*
*/} + {/*
*/} + {/*

[IMAGE SET AS BACKGROUND OF THIS DIV]

*/} + {/*
*/} + {/*
*/} + {/*

Event Number Two?

*/} + {/*

Tickets on sale 03/02/21

*/} + {/*
*/} + {/*
*/}
diff --git a/frontend/src/components/EventRow.tsx b/frontend/src/components/EventRow.tsx new file mode 100644 index 00000000..48d8f683 --- /dev/null +++ b/frontend/src/components/EventRow.tsx @@ -0,0 +1,39 @@ +import React from "react"; + +const baseEventImageStyle = { + backgroundSize: "contain", + backgroundRepeat: "no-repeat", + backgroundPosition: "center", + display: "flex", + flex: 1, + margin: "auto", + width: "90%", + maxHeight: "80%", +}; + +interface RowProps { + imageURL: string; + title: string; + saleDate: string; + background: string; + ticketsOnSale?: boolean; +} + +export default class EventRow extends React.PureComponent { + render() { + return ( +
+
+
+ {/*

[IMAGE SET AS BACKGROUND OF THIS DIV]

*/} +
+
+
+

{this.props.title}

+ {this.props.ticketsOnSale ? : null} +

Tickets on sale {this.props.saleDate}

+
+
+ ); + } +} \ No newline at end of file diff --git a/frontend/src/components/EventsList.tsx b/frontend/src/components/EventsList.tsx new file mode 100644 index 00000000..56cd7647 --- /dev/null +++ b/frontend/src/components/EventsList.tsx @@ -0,0 +1,23 @@ +export interface EventItem { + title: string; + ticketsURL: string; + headerURL: string; + backgroundColor: string; +} + +export interface EventData { + events: Array; + generatedAt: number; // Timestamp +} + +export const dummyResponse: EventData = { + events: [ + { + title: "Would I Lie To You?", + ticketsURL: "#", + headerURL: "/Logo_Export_Trans_but_not_on_HRT.png", + backgroundColor: "#2C1F39", + } + ], + generatedAt: 986712435, +} \ No newline at end of file