From c208e1e7b42dd9df701b90e7dd9053d20ca81e99 Mon Sep 17 00:00:00 2001 From: Safia Date: Thu, 10 Jun 2021 22:59:00 +0100 Subject: [PATCH 1/3] style in layout, index.js and event[id] send fetch to api/createResponse --- components/Layout.js | 8 +++++--- components/Layout.module.css | 11 +++++++++-- pages/events/[id].js | 32 ++++++++++++++++++++++++++++---- pages/index.js | 5 ++++- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/components/Layout.js b/components/Layout.js index 953c480..29a1b92 100644 --- a/components/Layout.js +++ b/components/Layout.js @@ -22,9 +22,11 @@ export default function Layout({ children }) { - -

chummy

- + + +

Chummy

+
+
{children}
); diff --git a/components/Layout.module.css b/components/Layout.module.css index 45bd7f8..3632bd1 100644 --- a/components/Layout.module.css +++ b/components/Layout.module.css @@ -1,9 +1,13 @@ @import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@694&display=swap"); +@import url('https://fonts.googleapis.com/css2?family=Lily+Script+One&family=Lobster&family=Lobster+Two&family=Open+Sans&family=Pacifico&display=swap'); + .header { - font-family: "Dancing Script", BlinkMacSystemFont; + /* font-family: "Dancing Script", BlinkMacSystemFont; */ + /* font-family: 'Open Sans', sans-serif; */ + font-family: 'Lily Script One', cursive; color: #fb9300; - font-size: 3rem; + font-size: 4rem; text-align: center; } @@ -33,6 +37,9 @@ left: 0; bottom: 0; margin-bottom: 35px; + font-family: 'Open Sans', sans-serif; + /* color: #fb9300; */ + /* font-size: 0.5rem; */ } .nav { diff --git a/pages/events/[id].js b/pages/events/[id].js index ca7e042..0d00112 100644 --- a/pages/events/[id].js +++ b/pages/events/[id].js @@ -13,6 +13,7 @@ import { useState, useEffect } from "react"; import { useSession } from "next-auth/client"; import Image from "next/image"; import Link from "next/link"; +import { useRouter } from "next/router"; export async function getStaticPaths() { const events = await getAllEventsData(); @@ -63,6 +64,29 @@ export default function Event({ eventResponseDataByEventIdStr, eventResponseCommenterStr, }) { + + const router = useRouter(); + + const addEventResponseToDb = (event) =>{ + event.preventDefault(); // don't redirect the page + // where we'll add our form logic + return fetch("/api/createProfile", { + body: JSON.stringify({ + // test: 'hi' + response_content: event.target.response_content.value, + }), + headers: { + "Content-Type": "application/json", + }, + method: "POST", + }); + + //const result = res.json(); + }; + + + + const eventDataParsed = JSON.parse(eventDataStr); const userDataParsed = JSON.parse(userDataByIdStr); const eventResponseDataParsed = JSON.parse(eventResponseDataByEventIdStr); @@ -151,11 +175,11 @@ export default function Event({ Comments

-
- + +