From 172390eac3a3f29cc601b2c3b216e9081fbd4da7 Mon Sep 17 00:00:00 2001 From: jency Date: Fri, 25 Apr 2025 01:17:15 +0530 Subject: [PATCH 1/4] Redesigned Navbar and Theme Toggler to Match Accord Project's Professional UI Signed-off-by: jency --- src/components/Navbar.tsx | 394 ++++++++++++++++-------------- src/components/ToggleDarkMode.tsx | 45 +++- 2 files changed, 250 insertions(+), 189 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 35fe9fef..be93a320 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -9,7 +9,7 @@ import { InfoOutlined, BookOutlined, CaretDownFilled, - MenuOutlined + MenuOutlined, } from "@ant-design/icons"; import ToggleDarkMode from "./ToggleDarkMode"; @@ -20,9 +20,7 @@ interface NavbarProps { } function Navbar({ scrollToFooter }: NavbarProps) { - const [hovered, setHovered] = useState< - null | "home" | "explore" | "help" | "github" | "join" - >(null); + const [hovered, setHovered] = useState(null); const screens = useBreakpoint(); const location = useLocation(); @@ -39,110 +37,99 @@ function Navbar({ scrollToFooter }: NavbarProps) { const mobileMenu = ( - - Template Playground - + Template Playground + Explore + - About + - Community + Issues + - + Github + + + + + Documentation - - ); - const helpMenu = ( - - - - - About - - - - - Community - - - - - Issues - - - - - - - Documentation - - - ); const menuItemStyle = (key: string, isLast: boolean) => ({ display: "flex", alignItems: "center", - padding: screens.md ? "0 20px" : "0", - backgroundColor: - hovered === key ? "rgba(255, 255, 255, 0.1)" : "transparent", height: "65px", - borderRight: - screens.md && !isLast ? "1.5px solid rgba(255, 255, 255, 0.1)" : "none", + padding: screens.md ? "0 5px" : "0", + backgroundColor: "transparent", + transition: "background-color 0.3s ease", }); const isLearnPage = location.pathname.startsWith("/learn"); + const menuItemButtonStyle = (key: string): React.CSSProperties => ({ + background: 'transparent', + border: "none", + color: hovered === key ? "#19c6c7" : '#fff', + height: "65px", + alignItems: "center", + fontSize: "1rem", + fontWeight: "600", + fontStyle: "normal", + position: "relative", + display: "block", + lineHeight: "1", + textDecoration: "none", + transition: 'all 0.3s ease', + }); + + const iconStyle = { + color: "#19c6c7", + fontSize: "17px" + }; + + return (
setHovered("home")} onMouseLeave={() => setHovered(null)} > - Template Playground - Template Playground - + + Template Playground +
+ {screens.md ? ( <>
setHovered("explore")} + onMouseEnter={() => setHovered("about")} onMouseLeave={() => setHovered(null)} > - Explore + + +
-
setHovered("help")} + +
setHovered("community")} + onMouseLeave={() => setHovered(null)} + > + + + +
+ +
setHovered("issues")} + onMouseLeave={() => setHovered(null)} + > + + + +
+ +
setHovered("documentation")} + onMouseLeave={() => setHovered(null)} + > + + + +
+ +
setHovered("github")} onMouseLeave={() => setHovered(null)} > - - - +
) : ( -
+
-
)} -
-
- -
+ {!isLearnPage && (
setHovered("join")} onMouseLeave={() => setHovered(null)} > - - - Learn - + + Learn
)} -
setHovered("github")} - onMouseLeave={() => setHovered(null)} > - - - Github - +
+
); diff --git a/src/components/ToggleDarkMode.tsx b/src/components/ToggleDarkMode.tsx index d3bd390b..7fa77497 100644 --- a/src/components/ToggleDarkMode.tsx +++ b/src/components/ToggleDarkMode.tsx @@ -1,7 +1,6 @@ import React, { useEffect, useState } from "react"; -import { ToggleDarkModeContainer } from "../styles/components/ToggleDarkMode"; -import DarkModeToggle from "react-dark-mode-toggle"; import useAppStore from "../store/store"; +import { FaMoon, FaSun } from "react-icons/fa"; const ToggleDarkMode: React.FC = () => { const { backgroundColor, toggleDarkMode } = useAppStore(); @@ -13,20 +12,44 @@ const ToggleDarkMode: React.FC = () => { const handleChange = () => { toggleDarkMode(); - setIsDarkMode((prev) => !prev); const newTheme = !isDarkMode ? "dark" : "light"; document.documentElement.setAttribute("data-theme", newTheme); + setIsDarkMode(!isDarkMode); }; return ( - - - +
+
+ {isDarkMode ? : } +
+
); }; From b97a3ceff7eb0ba3036bce71a2db1467db8523e5 Mon Sep 17 00:00:00 2001 From: jency Date: Fri, 25 Apr 2025 02:04:55 +0530 Subject: [PATCH 2/4] fixed changes - removed unused variables Signed-off-by: jency --- src/components/Navbar.tsx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index be93a320..139af9db 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,6 +1,6 @@ +// import { useSpring, animated } from "react-spring"; import { useState } from "react"; import { Menu, Dropdown, Button, Image, Grid } from "antd"; -import { useSpring, animated } from "react-spring"; import { useLocation, Link } from "react-router-dom"; import { GithubOutlined, @@ -8,8 +8,8 @@ import { UserOutlined, InfoOutlined, BookOutlined, - CaretDownFilled, MenuOutlined, + // CaretDownFilled, } from "@ant-design/icons"; import ToggleDarkMode from "./ToggleDarkMode"; @@ -24,15 +24,15 @@ function Navbar({ scrollToFooter }: NavbarProps) { const screens = useBreakpoint(); const location = useLocation(); - const props = useSpring({ - loop: true, - from: { opacity: 0.5, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" }, - to: [ - { opacity: 1, boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)" }, - { opacity: 0.9, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" }, - ], - config: { duration: 1000 }, - }); + // const props = useSpring({ + // loop: true, + // from: { opacity: 0.5, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" }, + // to: [ + // { opacity: 1, boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)" }, + // { opacity: 0.9, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" }, + // ], + // config: { duration: 1000 }, + // }); const mobileMenu = ( @@ -97,7 +97,7 @@ function Navbar({ scrollToFooter }: NavbarProps) { ); - const menuItemStyle = (key: string, isLast: boolean) => ({ + const menuItemStyle = () => ({ display: "flex", alignItems: "center", height: "65px", @@ -145,7 +145,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("home")} onMouseLeave={() => setHovered(null)} @@ -190,7 +190,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("about")} onMouseLeave={() => setHovered(null)} @@ -208,7 +208,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("community")} onMouseLeave={() => setHovered(null)} @@ -227,7 +227,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("issues")} onMouseLeave={() => setHovered(null)} @@ -246,7 +246,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("documentation")} onMouseLeave={() => setHovered(null)} @@ -265,7 +265,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
setHovered("github")} onMouseLeave={() => setHovered(null)} From 77e2c0b831acbff41db706cdff5b984e54ac87ae Mon Sep 17 00:00:00 2001 From: jency Date: Fri, 25 Apr 2025 02:36:04 +0530 Subject: [PATCH 3/4] fixed deprecated variable Signed-off-by: jency --- src/components/Navbar.tsx | 138 ++++++++++++++++++++------------------ 1 file changed, 74 insertions(+), 64 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 139af9db..53f0b637 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,6 +1,6 @@ // import { useSpring, animated } from "react-spring"; import { useState } from "react"; -import { Menu, Dropdown, Button, Image, Grid } from "antd"; +import { Dropdown, Button, Image, Grid } from "antd"; import { useLocation, Link } from "react-router-dom"; import { GithubOutlined, @@ -34,68 +34,78 @@ function Navbar({ scrollToFooter }: NavbarProps) { // config: { duration: 1000 }, // }); - const mobileMenu = ( - - - Template Playground - - - - Explore - - - - - About - - - - - - Community - - - - - - Issues - - - - - - Github - - - - - - Documentation - - - - - ); + const mobileMenu = { + items: [ + { + key: "home", + label: Template Playground, + }, + { + key: "explore", + label:
Explore
, + }, + { + key: "about", + label: ( + + About + + ), + }, + { + key: "community", + label: ( + + Community + + ), + }, + { + key: "issues", + label: ( + + Issues + + ), + }, + { + key: "github", + label: ( + + Github + + ), + }, + { + key: "documentation", + label: ( + + Documentation + + ), + }, + ], + }; const menuItemStyle = () => ({ display: "flex", @@ -285,7 +295,7 @@ function Navbar({ scrollToFooter }: NavbarProps) {
- +