From a7bded6db303def5c84878904356fce6a101721a Mon Sep 17 00:00:00 2001 From: Gaurav Tak Date: Tue, 12 Nov 2024 16:36:21 +0530 Subject: [PATCH 1/3] change navdrop links and sub-links style on hover --- components/Navbar/navDrop.js | 8 ++--- package-lock.json | 60 ------------------------------------ styles/globals.css | 3 +- 3 files changed, 6 insertions(+), 65 deletions(-) diff --git a/components/Navbar/navDrop.js b/components/Navbar/navDrop.js index 52396ca7..f78dc250 100644 --- a/components/Navbar/navDrop.js +++ b/components/Navbar/navDrop.js @@ -22,7 +22,7 @@ const NavDrop = forwardRef((props, ref)=> { {link.subMenu ? (
-
{link.title}
+
{link.title}
{
setDrop(false)} - className='h-[40px] flex navbg items-center p-6 hover:text-black text-white cursor-pointer' + className='h-[40px] flex navbg transition duration-150 ease-out items-center p-6 hover:text-black text-white cursor-pointer' > {sub.title}
@@ -45,7 +45,7 @@ const NavDrop = forwardRef((props, ref)=> { )}
) : ( -
setDrop(false)}> +
setDrop(false)}> {link.title}
)} @@ -59,4 +59,4 @@ const NavDrop = forwardRef((props, ref)=> { }) NavDrop.displayName = 'NavDrop'; -export default NavDrop; \ No newline at end of file +export default NavDrop; diff --git a/package-lock.json b/package-lock.json index c7e60746..6f4a9569 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7214,66 +7214,6 @@ "dependencies": { "rafor": "^1.0.2" } - }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz", - "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz", - "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-freebsd-x64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz", - "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz", - "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/styles/globals.css b/styles/globals.css index 4b9c83b3..9a51bae8 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -90,6 +90,7 @@ body { } .navbg:hover, .navbg:focus{ background: linear-gradient(225deg, #AD20E2 9.35%, #2DCCFD 88.41%); + border-radius: 15px; } .kinda-dark{ @@ -225,4 +226,4 @@ mix-blend-mode: lighten; .hoverEffect:hover { transform: scale(1.1); /* Scale the image by 10% on hover */ -} \ No newline at end of file +} From 021b4677908eb0b3535219585e301f4dc76bf77d Mon Sep 17 00:00:00 2001 From: Gaurav Tak Date: Thu, 14 Nov 2024 01:42:32 +0530 Subject: [PATCH 2/3] requested changes done pr#463:highlight currently active link --- components/Navbar/navDrop.js | 28 ++++++++++++++++++++-------- styles/globals.css | 8 ++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/components/Navbar/navDrop.js b/components/Navbar/navDrop.js index f78dc250..194f4507 100644 --- a/components/Navbar/navDrop.js +++ b/components/Navbar/navDrop.js @@ -1,12 +1,24 @@ -import React,{useState,forwardRef} from 'react'; +import React,{useState,forwardRef, useEffect} from 'react'; import links from '../../config/links.json'; import Link from 'next/link'; import Dropdown from '../illustration/dropdown'; const NavDrop = forwardRef((props, ref)=> { - const {setDrop}=props; - const [show, setShow] = useState(null); + const {setDrop}=props; + const [show, setShow] = useState(null); + const [active, setActive] = useState(null); + const [activeSubMenu, setActiveSubMenu] = useState(null); + + const currentUrl = window.location.href + let currentMenu = currentUrl.split('/')[(currentUrl.split('/')).length - 2] + let currentSubMenu = "/" + currentMenu + '/' + currentUrl.split('/')[(currentUrl.split('/')).length - 1] + + useEffect(() => { + setActive(currentMenu) + setActiveSubMenu(currentSubMenu) + }, [currentUrl]) + return (
@@ -16,13 +28,13 @@ const NavDrop = forwardRef((props, ref)=> {
- show === link.title ? setShow(null) : setShow(link.title) + show === link.title ? setShow(null): setShow(link.title) } > {link.subMenu ? (
-
{link.title}
+
{link.title}
{ {link.subMenu.map((sub) => (
setDrop(false)} - className='h-[40px] flex navbg transition duration-150 ease-out items-center p-6 hover:text-black text-white cursor-pointer' + onClick={() => setDrop(false)} + className={`h-[40px] flex ${activeSubMenu === sub.ref ? 'navbg-fixed' : 'navbg'} transition duration-150 ease-out items-center p-6 cursor-pointer`} > {sub.title}
@@ -45,7 +57,7 @@ const NavDrop = forwardRef((props, ref)=> { )}
) : ( -
setDrop(false)}> +
setDrop(false)}> {link.title}
)} diff --git a/styles/globals.css b/styles/globals.css index 9a51bae8..d02afef8 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -88,9 +88,17 @@ body { .transparent-bg{ @apply w-56 h-48 rounded gradient-bg absolute bottom-0 left-0 translate-x-full ease-out duration-500 transition-all translate-y-full mb-9 ml-9 group-hover:ml-0 group-hover:mb-32 group-hover:translate-x-0 } + +.navbg-fixed { + background: linear-gradient(225deg, #AD20E2 9.35%, #2DCCFD 88.41%); + border-radius: 15px; + color: black; +} + .navbg:hover, .navbg:focus{ background: linear-gradient(225deg, #AD20E2 9.35%, #2DCCFD 88.41%); border-radius: 15px; + color: black; } .kinda-dark{ From 3cf0fc181e614a29e659c007580b90c8643e894e Mon Sep 17 00:00:00 2001 From: Gaurav Tak Date: Thu, 14 Nov 2024 02:12:24 +0530 Subject: [PATCH 3/3] remove changes from package-lock.json (#463) --- package-lock.json | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/package-lock.json b/package-lock.json index 6f4a9569..c7e60746 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7214,6 +7214,66 @@ "dependencies": { "rafor": "^1.0.2" } + }, + "node_modules/@next/swc-android-arm-eabi": { + "version": "12.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz", + "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-android-arm64": { + "version": "12.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz", + "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-freebsd-x64": { + "version": "12.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz", + "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm-gnueabihf": { + "version": "12.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz", + "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } } } }