From b3f2c34f00d49c5f8f3fa8b6669e5cb99fb33e4a Mon Sep 17 00:00:00 2001 From: Omkaar Kamath Date: Sat, 13 May 2023 15:42:44 -0400 Subject: [PATCH] Good stuff --- frontend/src/App.js | 2 + .../src/components/CreateRestaurantPortal.js | 56 +++++++++++++++++++ .../components/CreateRestaurantPortal.scss | 4 ++ 3 files changed, 62 insertions(+) create mode 100644 frontend/src/components/CreateRestaurantPortal.js create mode 100644 frontend/src/components/CreateRestaurantPortal.scss diff --git a/frontend/src/App.js b/frontend/src/App.js index 77d3928..ca7bcf1 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -4,6 +4,7 @@ import React from 'react'; // Define relative imports here import Title from './components/Title'; import DisplayContainer from './components/DisplayContainer'; +import CreateRestaurantPortal from './components/CreateRestaurantPortal'; /** * This is the root component of your React App. @@ -12,6 +13,7 @@ import DisplayContainer from './components/DisplayContainer'; const App = () => { return (
+ {window.location.pathname === "/" && }
diff --git a/frontend/src/components/CreateRestaurantPortal.js b/frontend/src/components/CreateRestaurantPortal.js new file mode 100644 index 0000000..f02a9fe --- /dev/null +++ b/frontend/src/components/CreateRestaurantPortal.js @@ -0,0 +1,56 @@ +/** + * This is a functional stateless component. Its primary function is to display the props that were passed into it. + * It is stateless so it doesn't need to extend React.Component. + * However, `import React from 'react';` needs to be stated everywhere jsx is used. + * This component will not have access to React Component Lifecycles. + */ + +import React, { useState } from 'react'; +import PropTypes from 'prop-types'; + +import './CreateRestaurantPortal.scss'; + +const CreateRestaurantPortal = () => { + const [name, setName] = useState(""); + const [description, setDescription] = useState(""); + const [restaurantIds, setRestaurantIds] = useState([]); + + const handleGroupNameChange = (e) => { + setName(e.target.value); + }; + + const handleGroupDescriptionChange = (e) => { + setDescription(e.target.value) + }; + + const handleGroupRestaurantIdsChange = (e) => { + setRestaurantIds(e.target.value) + }; + + const handleSubmit = async (name, description, restaurantIds) => { + // Implement later + } + + return ( +
+ handleGroupNameChange(e)} /> + handleGroupDescriptionChange(e)} /> + handleGroupRestaurantIdsChange(e)} /> + +
+ ) +} + +export default CreateRestaurantPortal; + +CreateRestaurantPortal.propTypes = { + name: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + restaurantIds: PropTypes.array.isRequired +}; + +CreateRestaurantPortal.defaultProps = { + name: "", + description: "", + restaurantIds: [] +}; diff --git a/frontend/src/components/CreateRestaurantPortal.scss b/frontend/src/components/CreateRestaurantPortal.scss new file mode 100644 index 0000000..1aa36d4 --- /dev/null +++ b/frontend/src/components/CreateRestaurantPortal.scss @@ -0,0 +1,4 @@ +.create-restaurant-portal { + display: flex; + flex-direction: column; +}