From 368c4305703c08d067e718177f86059e8bb7c975 Mon Sep 17 00:00:00 2001 From: Anirban Ghosh Date: Sun, 20 Oct 2024 09:48:28 +0530 Subject: [PATCH 1/2] Made changes --- frontend/src/components/Navbar.jsx | 188 ++++++++++------------------- frontend/src/components/Tabs.jsx | 15 ++- frontend/src/pages/Login/Login.jsx | 4 - 3 files changed, 75 insertions(+), 132 deletions(-) diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index a4ebc93c..a163ad1c 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -1,9 +1,8 @@ import React, { useState, useEffect, useRef } from "react"; import ProfileInfo from "./Cards/ProfileInfo"; -import { useNavigate, useLocation } from "react-router-dom"; +import { useNavigate, useLocation, Link } from "react-router-dom"; import SearchBar from "./SearchBar/SearchBar"; import { toast } from "react-hot-toast"; -import { Link } from "react-router-dom"; import gsap from "gsap/all"; import { SlideTabsExample } from "./Tabs"; @@ -19,84 +18,17 @@ const Navbar = ({ userInfo, onSearchNote, handleClearSearch }) => { const signupButtonRef = useRef(null); useEffect(() => { - gsap.fromTo( - logoRef.current, - { - y: -20, - opacity: 0, - scale: 0.8, - }, - { - duration: 1, - y: 0, - opacity: 1, - scale: 1, - ease: "power3.out", - } - ); - - gsap.fromTo( - searchBarRef.current, - { - x: 50, - opacity: 0, - }, - { - duration: 1, - x: 0, - opacity: 1, - ease: "power3.out", - delay: 0.5, - } - ); - - gsap.fromTo( - profileRef.current, - { - opacity: 0, - scale: 0.8, - }, - { - duration: 1, - opacity: 1, - scale: 1, - ease: "power3.out", - delay: 1, - } - ); - + // GSAP animations + gsap.fromTo(logoRef.current, { y: -20, opacity: 0, scale: 0.8 }, { duration: 1, y: 0, opacity: 1, scale: 1, ease: "power3.out" }); + gsap.fromTo(searchBarRef.current, { x: 50, opacity: 0 }, { duration: 1, x: 0, opacity: 1, ease: "power3.out", delay: 0.5 }); + gsap.fromTo(profileRef.current, { opacity: 0, scale: 0.8 }, { duration: 1, opacity: 1, scale: 1, ease: "power3.out", delay: 1 }); + + // Animating login/signup buttons if (loginButtonRef.current) { - gsap.fromTo( - loginButtonRef.current, - { - opacity: 0, - y: 20, - }, - { - duration: 1, - opacity: 1, - y: 0, - ease: "bounce.out", - delay: 1.7, - } - ); + gsap.fromTo(loginButtonRef.current, { opacity: 0, y: 20 }, { duration: 1, opacity: 1, y: 0, ease: "bounce.out", delay: 1.7 }); } - if (signupButtonRef.current) { - gsap.fromTo( - signupButtonRef.current, - { - opacity: 0, - y: 20, - }, - { - duration: 1, - opacity: 1, - y: 0, - ease: "bounce.out", - delay: 1.5, - } - ); + gsap.fromTo(signupButtonRef.current, { opacity: 0, y: 20 }, { duration: 1, opacity: 1, y: 0, ease: "bounce.out", delay: 1.5 }); } }, []); @@ -123,57 +55,63 @@ const Navbar = ({ userInfo, onSearchNote, handleClearSearch }) => { const hideSearchBarPaths = ["/", "/my-profile", "/about"]; return ( -
- -
- logo +
+
+ {/* Logo */} + +
+ logo

- cribbie -

-
- - - {userInfo && !hideSearchBarPaths.includes(location.pathname) && ( -
- { - setSearchQuery(target.value); - onSearchNote(target.value); - }} - onClearSearch={onClearSearch} - /> -
- )} + cribbie + +
+ + + + + {/* Tabs */} + + + {/* Search bar (hidden on specific paths) */} + {userInfo && !hideSearchBarPaths.includes(location.pathname) && ( +
+ { + setSearchQuery(target.value); + onSearchNote(target.value); + }} + onClearSearch={onClearSearch} + /> +
+ )} - {userInfo ? ( -
- -
- ) : ( - location.pathname !== "/login" && - location.pathname !== "/signup" && ( -
- - + {/* Profile or Signup/Login */} + {userInfo ? ( +
+
- ) - )} + ) : ( + location.pathname !== "/login" && location.pathname !== "/signup" && ( +
+ + +
+ ) + )} +
); }; diff --git a/frontend/src/components/Tabs.jsx b/frontend/src/components/Tabs.jsx index 2d00b924..7dc0c118 100644 --- a/frontend/src/components/Tabs.jsx +++ b/frontend/src/components/Tabs.jsx @@ -4,7 +4,7 @@ import { Link, useLocation } from "react-router-dom"; export const SlideTabsExample = () => { return ( -
+
); @@ -29,17 +29,26 @@ const SlideTabs = () => { })); setHoveredTab(null); }} - className="relative mx-auto flex w-fit bg-white p-1" + className="relative mx-auto b flex w-fit bg-white p-1" > Home + + Dashboard + { return (
-
- -
-
From 6a426ba8f0f8f5d947ceb52e62078108d10e5ff2 Mon Sep 17 00:00:00 2001 From: Anirban Ghosh Date: Sun, 20 Oct 2024 09:54:10 +0530 Subject: [PATCH 2/2] changes in the sign-up --- frontend/src/pages/Signup/Signup.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/pages/Signup/Signup.jsx b/frontend/src/pages/Signup/Signup.jsx index fb59c27c..c0601dd1 100644 --- a/frontend/src/pages/Signup/Signup.jsx +++ b/frontend/src/pages/Signup/Signup.jsx @@ -219,9 +219,7 @@ const Signup = () => { return (
-
- -
+