Skip to content

Commit b3f2c34

Browse files
committed
Good stuff
1 parent 6ee3c34 commit b3f2c34

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

frontend/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44
// Define relative imports here
55
import Title from './components/Title';
66
import DisplayContainer from './components/DisplayContainer';
7+
import CreateRestaurantPortal from './components/CreateRestaurantPortal';
78

89
/**
910
* This is the root component of your React App.
@@ -12,6 +13,7 @@ import DisplayContainer from './components/DisplayContainer';
1213
const App = () => {
1314
return (
1415
<div className="App">
16+
<CreateRestaurantPortal />
1517
<Title teamName="your_team_name"></Title>
1618
{window.location.pathname === "/" && <DisplayContainer />}
1719
</div>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* This is a functional stateless component. Its primary function is to display the props that were passed into it.
3+
* It is stateless so it doesn't need to extend React.Component.
4+
* However, `import React from 'react';` needs to be stated everywhere jsx is used.
5+
* This component will not have access to React Component Lifecycles.
6+
*/
7+
8+
import React, { useState } from 'react';
9+
import PropTypes from 'prop-types';
10+
11+
import './CreateRestaurantPortal.scss';
12+
13+
const CreateRestaurantPortal = () => {
14+
const [name, setName] = useState("");
15+
const [description, setDescription] = useState("");
16+
const [restaurantIds, setRestaurantIds] = useState([]);
17+
18+
const handleGroupNameChange = (e) => {
19+
setName(e.target.value);
20+
};
21+
22+
const handleGroupDescriptionChange = (e) => {
23+
setDescription(e.target.value)
24+
};
25+
26+
const handleGroupRestaurantIdsChange = (e) => {
27+
setRestaurantIds(e.target.value)
28+
};
29+
30+
const handleSubmit = async (name, description, restaurantIds) => {
31+
// Implement later
32+
}
33+
34+
return (
35+
<div className="create-restaurant-portal">
36+
<input placeholder="Enter restaurant name" value={name} onChange={(e) => handleGroupNameChange(e)} />
37+
<input placeholder="Enter restaurant description" value={description} onChange={(e) => handleGroupDescriptionChange(e)} />
38+
<input placeholder="Enter restaurant ids (list format ['a', 'b'])" value={restaurantIds} onChange={(e) => handleGroupRestaurantIdsChange(e)} />
39+
<button onClick={() => handleSubmit(name, description, restaurantIds)}>Submit</button>
40+
</div>
41+
)
42+
}
43+
44+
export default CreateRestaurantPortal;
45+
46+
CreateRestaurantPortal.propTypes = {
47+
name: PropTypes.string.isRequired,
48+
description: PropTypes.string.isRequired,
49+
restaurantIds: PropTypes.array.isRequired
50+
};
51+
52+
CreateRestaurantPortal.defaultProps = {
53+
name: "",
54+
description: "",
55+
restaurantIds: []
56+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.create-restaurant-portal {
2+
display: flex;
3+
flex-direction: column;
4+
}

0 commit comments

Comments
 (0)