From 5d84e64201bcbe24535b9addd63951fde3140587 Mon Sep 17 00:00:00 2001 From: Supriya <56571107+priyaraj7@users.noreply.github.com> Date: Fri, 4 Nov 2022 10:15:11 -0700 Subject: [PATCH] Fetching Google API Data (#3) * add header component * trying to fetch api dynamically * update query * rending data(menu info) frontend * do some cleanup * add key to map function * commentout category props * fetch googleapi backend * add google mock api code * fetching google Api from frontend * add google api info * add contact page * change file name * delete commentout code * change let to const Co-authored-by: Chris Jaure * change parameter author to review Co-authored-by: Chris Jaure Co-authored-by: Chris Jaure --- client/src/App.js | 9 +- client/src/api/categoryApi.js | 6 + client/src/api/googleApi.js | 6 + client/src/component/customer/ContactPage.js | 134 ++++++ client/src/component/customer/CustomerPage.js | 17 + client/src/component/customer/Header.js | 255 +++++++++++ client/src/component/customer/Menu.js | 166 +++++++ client/src/component/customer/ReviewPage.js | 119 +++++ package-lock.json | 379 ++++++++++++++++ package.json | 1 + server/.env.example | 4 +- server/api/googleApi.js | 34 ++ server/api/mockGoogleApiData .js | 420 ++++++++++++++++++ server/package-lock.json | 127 ++++++ server/package.json | 2 + server/server.js | 2 + 16 files changed, 1678 insertions(+), 3 deletions(-) create mode 100644 client/src/api/categoryApi.js create mode 100644 client/src/api/googleApi.js create mode 100644 client/src/component/customer/ContactPage.js create mode 100644 client/src/component/customer/CustomerPage.js create mode 100644 client/src/component/customer/Header.js create mode 100644 client/src/component/customer/Menu.js create mode 100644 client/src/component/customer/ReviewPage.js create mode 100644 server/api/googleApi.js create mode 100644 server/api/mockGoogleApiData .js diff --git a/client/src/App.js b/client/src/App.js index dfef6e2..fb93b7c 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,11 +1,16 @@ import "./App.css"; import { ChakraProvider } from "@chakra-ui/react"; -import Customer from "./component/customerPage/Customer.js"; + +import CustomerPage from "./component/customer/CustomerPage.js"; + + function App() { return ( - + + + ); } diff --git a/client/src/api/categoryApi.js b/client/src/api/categoryApi.js new file mode 100644 index 0000000..90ae2a7 --- /dev/null +++ b/client/src/api/categoryApi.js @@ -0,0 +1,6 @@ +export const getAllItem = async (id) => { + const response = await fetch(`/api/${id}`); + const result = await response.json(); + + return result; +}; diff --git a/client/src/api/googleApi.js b/client/src/api/googleApi.js new file mode 100644 index 0000000..f6f8b1f --- /dev/null +++ b/client/src/api/googleApi.js @@ -0,0 +1,6 @@ +export const getReviews = async () => { + const response = await fetch(`/place/reviews`); + const result = await response.json(); + + return result; +}; diff --git a/client/src/component/customer/ContactPage.js b/client/src/component/customer/ContactPage.js new file mode 100644 index 0000000..6dc18f4 --- /dev/null +++ b/client/src/component/customer/ContactPage.js @@ -0,0 +1,134 @@ +import { + Container, + Flex, + Box, + Heading, + Text, + Button, + VStack, + Wrap, + WrapItem, + FormControl, + FormLabel, + Input, + InputGroup, + InputLeftElement, + Textarea, + Link, +} from "@chakra-ui/react"; +import { MdPhone, MdLocationOn, MdOutlineEmail } from "react-icons/md"; +import { BsPerson, BsPhone } from "react-icons/bs"; + +function ContactPage() { + return ( + + + + + + + + Contact + + Fill up the form below to contact + + + + + + + + + + + + + + + + Your Name + + } + /> + + + + + Mail + + } + /> + + + + + Phone Number + + } + /> + + + + + Message +