From ab03de3659d39fe67f566240dc3a2a6ac9ab9634 Mon Sep 17 00:00:00 2001 From: tanish35 Date: Mon, 28 Oct 2024 11:07:31 +0530 Subject: [PATCH] Fix college names,change signup,fix line bug --- frontend/src/components/AddDetails.jsx | 2 +- frontend/src/components/Register.jsx | 335 ++++++++++-------- frontend/src/components/SearchBar.jsx | 35 +- frontend/src/components/data/collegeNames.jsx | 16 +- frontend/src/styles/register.css | 202 +++++++++++ 5 files changed, 422 insertions(+), 168 deletions(-) create mode 100644 frontend/src/styles/register.css diff --git a/frontend/src/components/AddDetails.jsx b/frontend/src/components/AddDetails.jsx index 8d4da4e..ec78532 100644 --- a/frontend/src/components/AddDetails.jsx +++ b/frontend/src/components/AddDetails.jsx @@ -21,7 +21,7 @@ import { z } from "zod"; import axios from "axios"; import { useNavigate } from "react-router-dom"; -import { collegeNames } from "./data/collegeNames"; +import collegeNames from "./data/collegeNames"; import { courseNames } from "./data/courseName"; import { location } from "./data/location"; diff --git a/frontend/src/components/Register.jsx b/frontend/src/components/Register.jsx index 9f15972..23122b3 100644 --- a/frontend/src/components/Register.jsx +++ b/frontend/src/components/Register.jsx @@ -16,11 +16,12 @@ import { useToast, } from "@chakra-ui/react"; import { set, z } from "zod"; +import "../styles/register.css"; import axios from "axios"; import { useNavigate } from "react-router-dom"; -import { collegeNames } from "./data/collegeNames"; +import collegeNames from "./data/collegeNames"; import { courseNames } from "./data/courseName"; import { location } from "./data/location"; @@ -182,202 +183,238 @@ const RegisterForm = () => { }; return ( - - - Register - + {/* */} -
+ + + Register + - - Email + + Email {errors.email && {errors.email}} - - Username + + Username {errors.username && {errors.username}} - - Password + + Password {errors.password && {errors.password}} - - College Name - - setFormData({ ...formData, collegeName: newValue }), - }} - renderInputComponent={(inputProps) => ( - - )} - renderSuggestionsContainer={({ containerProps, children }) => ( - - {children} - - )} - /> + + College Name + + + setFormData({ ...formData, collegeName: newValue }), + }} + renderInputComponent={(inputProps) => ( + + )} + renderSuggestionsContainer={({ containerProps, children }) => { + const hasSuggestions = React.Children.count(children) > 0; + + return hasSuggestions ? ( + + {children} + + ) : null; + }} + /> + - - Course Name - - setFormData({ ...formData, courseName: newValue }), - }} - renderInputComponent={(inputProps) => ( - - )} - renderSuggestionsContainer={({ containerProps, children }) => ( - - {children} - - )} - /> + + Course Name + + + setFormData({ ...formData, courseName: newValue }), + }} + renderInputComponent={(inputProps) => ( + + )} + renderSuggestionsContainer={({ containerProps, children }) => { + const hasSuggestions = React.Children.count(children) > 0; + + return hasSuggestions ? ( + + {children} + + ) : null; + }} + /> + - - Location - - setFormData({ ...formData, location: newValue }), - }} - renderInputComponent={(inputProps) => ( - - )} - renderSuggestionsContainer={({ containerProps, children }) => ( - - {children} - - )} - /> + + Location + + + setFormData({ ...formData, location: newValue }), + }} + renderInputComponent={(inputProps) => ( + + )} + renderSuggestionsContainer={({ containerProps, children }) => { + const hasSuggestions = React.Children.count(children) > 0; + + return hasSuggestions ? ( + + {children} + + ) : null; + }} + /> + - - Is Online? + + + Is Online? + - Yes - No + + Yes + + + No + - diff --git a/frontend/src/components/SearchBar.jsx b/frontend/src/components/SearchBar.jsx index c2d5a63..2673e41 100644 --- a/frontend/src/components/SearchBar.jsx +++ b/frontend/src/components/SearchBar.jsx @@ -112,21 +112,26 @@ const SearchBar = () => { }} /> )} - renderSuggestionsContainer={({ containerProps, children }) => ( - - {children} - - )} + renderSuggestionsContainer={({ containerProps, children }) => { + const hasSuggestions = React.Children.count(children) > 0; + + return hasSuggestions ? ( + + {children} + + ) : null; + }} /> {/*