Skip to content

Commit

Permalink
Merge pull request #493 from Saksham2k3s/add-canteen-rating
Browse files Browse the repository at this point in the history
Added rating for canteen
  • Loading branch information
hustlerZzZ authored Aug 7, 2024
2 parents b9c2ab4 + 19b3ded commit 6886309
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"react-icons": "^4.12.0",
"react-icons-kit": "^2.0.0",
"react-modal": "^3.16.1",
"react-rating": "^2.0.5",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1",
"react-spinners": "^0.13.8",
Expand Down
29 changes: 29 additions & 0 deletions src/components/Ratings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from 'react';
import { useContext } from 'react';
import Box from '@mui/material/Box';
import Rating from '@mui/material/Rating';
import Typography from '@mui/material/Typography';
import { ThemeContext } from '../themeContext';

export default function BasicRating() {
const [value, setValue] = React.useState(2);
const { theme, toggleTheme } = useContext(ThemeContext);

return (
<Box
sx={{
'& > legend': { mt: 2 },
}}
>
<h2 className="text-lg font-bold mb-4 text-white text-start dark:text-black">Rate Canteen</h2>
<Rating
name="simple-controlled"
value={value}
onChange={(event, newValue) => {
setValue(newValue);
}}
size='large'
/>
</Box>
);
}
6 changes: 5 additions & 1 deletion src/pages/MenuPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import FoodCard from "../components/FoodCard";
import { ThemeContext } from '../themeContext';
import { Link } from "react-router-dom";
import { FaInstagram, FaFacebook, FaLinkedinIn, FaYoutube } from "react-icons/fa";
import BasicRating from "../components/Ratings";



Expand Down Expand Up @@ -287,14 +288,17 @@ const handlestudentFeedbackSubmit = async () => {
</>
)}
</div>

<div className=" mt-20 text-purple-800 px-8 mb-4">
<h2 className="text-2xl font-bold mb-4 text-white text-center dark:text-black">Meal Feedback</h2>
<BasicRating/>
<textarea
className="w-full h-32 p-4 border border-purple-300 rounded mb-4"
className="w-full h-32 p-4 border border-purple-300 rounded mb-4 mt-5 "
placeholder="Enter your feedback here..."
value={studentfeedback}
onChange={(e) => setstudentFeedback(e.target.value)}
></textarea>

<button
onClick={handlestudentFeedbackSubmit}
className="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"
Expand Down

0 comments on commit 6886309

Please sign in to comment.