From 19b3deddaadbd4ba9827063b7398c48fd16a7b54 Mon Sep 17 00:00:00 2001 From: Saksham2k3s Date: Tue, 6 Aug 2024 20:12:25 +0530 Subject: [PATCH] Added rating for canteen --- package.json | 1 + src/components/Ratings.jsx | 29 +++++++++++++++++++++++++++++ src/pages/MenuPage.jsx | 6 +++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/components/Ratings.jsx diff --git a/package.json b/package.json index 924e778..0b84cb3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/Ratings.jsx b/src/components/Ratings.jsx new file mode 100644 index 0000000..017f6df --- /dev/null +++ b/src/components/Ratings.jsx @@ -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 ( + legend': { mt: 2 }, + }} + > +

Rate Canteen

+ { + setValue(newValue); + }} + size='large' + /> +
+ ); +} diff --git a/src/pages/MenuPage.jsx b/src/pages/MenuPage.jsx index 6cd6b57..68e8cb6 100644 --- a/src/pages/MenuPage.jsx +++ b/src/pages/MenuPage.jsx @@ -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"; @@ -287,14 +288,17 @@ const handlestudentFeedbackSubmit = async () => { )} +

Meal Feedback

+ +