From 7c486f1fd5dcd9f206b5b04e73ac2968d17aa476 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Sat, 9 Nov 2024 20:12:28 +0530 Subject: [PATCH 1/4] Maked navbar sticky --- frontend/package-lock.json | 13 ------- frontend/src/App.css | 56 ++++++++++++++++-------------- frontend/src/Components/Navbar.jsx | 54 ++++++++++++++-------------- 3 files changed, 56 insertions(+), 67 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 061c25b2..4c37f5ff 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -3572,11 +3572,8 @@ "node_modules/css-mediaquery": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/css-mediaquery/-/css-mediaquery-0.1.2.tgz", - - "integrity": "sha512-COtn4EROW5dBGlE/4PiKnh6rZpAPxDeFLaEEwt4i10jpDMFt2EhQGS79QmmrO+iKCHv0PU/HrOWEhijFd1x99Q==", "license": "BSD" - }, "node_modules/cssesc": { "version": "3.0.0", @@ -4807,10 +4804,8 @@ "node_modules/hyphenate-style-name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.1.0.tgz", - "integrity": "sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw==", "license": "BSD-3-Clause" - }, "node_modules/idb": { "version": "7.1.1", @@ -5640,9 +5635,7 @@ "version": "0.453.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.453.0.tgz", "integrity": "sha512-kL+RGZCcJi9BvJtzg2kshO192Ddy9hv3ij+cPrVPWSRzgCWCVazoQJxOjAwgK53NomL07HB7GPHW120FimjNhQ==", - "license": "ISC", - "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc" } @@ -5660,9 +5653,7 @@ "version": "0.4.2", "resolved": "https://registry.npmjs.org/matchmediaquery/-/matchmediaquery-0.4.2.tgz", "integrity": "sha512-wrZpoT50ehYOudhDjt/YvUJc6eUzcdFPdmbizfgvswCKNHD1/OBOHYJpHie+HXpu6bSkEGieFMYk6VuutaiRfA==", - "license": "MIT", - "dependencies": { "css-mediaquery": "^0.1.2" } @@ -6368,9 +6359,7 @@ "version": "10.0.0", "resolved": "https://registry.npmjs.org/react-responsive/-/react-responsive-10.0.0.tgz", "integrity": "sha512-N6/UiRLGQyGUqrarhBZmrSmHi2FXSD++N5VbSKsBBvWfG0ZV7asvUBluSv5lSzdMyEVjzZ6Y8DL4OHABiztDOg==", - "license": "MIT", - "dependencies": { "hyphenate-style-name": "^1.0.0", "matchmediaquery": "^0.4.2", @@ -6797,10 +6786,8 @@ "node_modules/shallow-equal": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-3.1.0.tgz", - "integrity": "sha512-pfVOw8QZIXpMbhBWvzBISicvToTiM5WBF1EeAUZDDSb5Dt29yl4AYbyywbJFSEsRUMr7gJaxqCdr4L3tQf9wVg==", "license": "MIT" - }, "node_modules/shebang-command": { "version": "2.0.0", diff --git a/frontend/src/App.css b/frontend/src/App.css index 8419445a..83991d1f 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -5,7 +5,7 @@ #root { max-width: 1366px; margin: 0 auto; - overflow-x: hidden; + /* overflow-x: hidden; */ } #Hero { @@ -15,22 +15,26 @@ background-size: cover; } -.error{ +.error { margin-top: 0 !important; } /* Animations */ .animated-text { - animation: scaleText .7s ease-in-out 1 alternate; /* Animation properties */ + animation: scaleText .7s ease-in-out 1 alternate; + /* Animation properties */ transition: all smooth; } @keyframes scaleText { from { - font-size: 8rem; /* Initial font size */ + font-size: 8rem; + /* Initial font size */ } + to { - font-size: 4rem; /* Final font size */ + font-size: 4rem; + /* Final font size */ } } @@ -42,17 +46,17 @@ /* Track */ ::-webkit-scrollbar-track { - background: #fafafc; + background: #fafafc; } /* Handle */ ::-webkit-scrollbar-thumb { - background: #B91C1C !important; + background: #B91C1C !important; border-radius: 12px !important; } ::-webkit-scrollbar-thumb:hover { - background: #B91C1C!important; + background: #B91C1C !important; border-radius: 12px !important; } @@ -62,17 +66,17 @@ /* Track */ ::-webkit-scrollbar-track { - background: #fafafc; + background: #fafafc; } /* Handle */ ::-webkit-scrollbar-thumb { - background: #B91C1C !important; + background: #B91C1C !important; border-radius: 12px !important; } ::-webkit-scrollbar-thumb:hover { - background: #B91C1C!important; + background: #B91C1C !important; border-radius: 12px !important; } @@ -86,9 +90,10 @@ } } -.navbar{ - background-color: #fed4d4; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +.navbar { +background-color: #fed4d4; +box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + } .text-\[4rem\] { @@ -105,16 +110,13 @@ /* ADD THE CLASS OF CLAMPED-TEXT */ .clamped-text { - display: -webkit-box; - -webkit-box-orient: vertical; /* Define the orientation as vertical */ - -webkit-line-clamp: 4; /* Limit the number of lines to 4 */ - overflow: hidden; /* Hide any overflowed content */ - text-overflow: ellipsis; /* Add ellipsis (...) for overflow */ -} - - - - - - - + display: -webkit-box; + -webkit-box-orient: vertical; + /* Define the orientation as vertical */ + -webkit-line-clamp: 4; + /* Limit the number of lines to 4 */ + overflow: hidden; + /* Hide any overflowed content */ + text-overflow: ellipsis; + /* Add ellipsis (...) for overflow */ +} \ No newline at end of file diff --git a/frontend/src/Components/Navbar.jsx b/frontend/src/Components/Navbar.jsx index 3ae21844..5a6f5b30 100644 --- a/frontend/src/Components/Navbar.jsx +++ b/frontend/src/Components/Navbar.jsx @@ -46,7 +46,9 @@ const Navbar = () => { useEffect(() => { const handleScroll = () => { - if (window.scrollY > window.innerHeight) { + console.log(window.scrollY); + if (window.scrollY > 0) { + setIsSticky(true); } else { setIsSticky(false); @@ -68,10 +70,19 @@ const Navbar = () => { }; return ( + //