Skip to content

Commit f4059e5

Browse files
committed
Hero Section Updated
1 parent 6ba03f9 commit f4059e5

File tree

4 files changed

+58
-49
lines changed

4 files changed

+58
-49
lines changed

src/Components/landingpage/Navbar.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ import Container from 'react-bootstrap/Container';
55
const Navbar = () => {
66
const [sticky, setSticky] = useState(false);
77

8-
useEffect(() => {
9-
const handleScroll = () => {
10-
window.scrollY > 50 ? setSticky(true) : setSticky(false);
11-
};
8+
9+
useEffect(() => {
10+
const handleScroll = () => {
11+
setSticky(window.scrollY > 25);
12+
};
1213

13-
window.addEventListener('scroll', handleScroll);
14+
window.addEventListener("scroll", handleScroll);
15+
return () => window.removeEventListener("scroll", handleScroll);
16+
}, []);
1417

15-
// Cleanup the event listener on component unmount
16-
return () => {
17-
window.removeEventListener('scroll', handleScroll);
18-
};
19-
}, []);
2018

2119
return (
20+
<nav className={`Navbar ${sticky ? 'sticky' : ''}`}>
2221
<Container>
23-
<nav className={`Navbar ${sticky ? 'Navbar-dark' : ''}`}>
22+
<div className="Navbar-container">
2423
<img src={fullogo} alt="NepTech Tribe Logo" className="Navbar-logo" />
2524
<ul className="Navbar-menu">
2625
<li><Link to="/" className='link-default' >Home</Link></li>
@@ -29,8 +28,9 @@ const Navbar = () => {
2928
<li><Link to="/events" className='link-default'> Upcoming Events</Link></li>
3029
<li><Link to="/contact" className='link-default' >Contact Us</Link></li>
3130
</ul>
32-
</nav>
31+
</div>
3332
</Container>
33+
</nav>
3434
);
3535
};
3636

src/Styles/App.css

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
@import 'bootstrap/dist/css/bootstrap.min.css';
22
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
33
.Navbar {
4+
position: fixed;
45
width: 100%;
5-
padding: 1.25rem 0rem;
6-
background: #fff;
7-
display: flex;
8-
align-items: center;
9-
justify-content: space-between;
6+
top: 0;
7+
left: 0;
8+
right: 0;
9+
background-color: #fff;
1010
z-index: 100;
1111
font-family: "Poppins", sans-serif;
12+
transition: 0.5s;
1213
}
13-
.Navbar-dark {
14+
.Navbar.sticky {
1415
background: #212ea0;
15-
transition: 0.5s;
1616
color: #fff;
17+
top: 0;
18+
}
19+
.Navbar-container {
20+
padding: 1.25rem 0rem;
21+
display: flex;
22+
align-items: center;
23+
justify-content: space-between;
1724
}
1825
.Navbar-logo {
1926
width: 11rem;

src/Styles/App.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Styles/LandingPage/_Navbar.scss

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
.Navbar{
2-
width: 100%;
1+
.Navbar {
2+
position: fixed;
3+
width: 100%;
4+
top: 0;
5+
left: 0;
6+
right: 0;
7+
background-color: #fff;
8+
z-index: 100;
9+
font-family: $font;
10+
transition: 0.5s;
11+
&.sticky {
12+
background: #212ea0;
13+
color: #fff;
14+
top: 0;
15+
}
16+
&-container {
317
padding: 1.25rem 0rem;
4-
background: #fff;
518
display: flex;
619
align-items: center;
720
justify-content: space-between;
8-
z-index: 100;
9-
font-family: $font;
10-
&-dark{
11-
background: #212ea0;
12-
transition: .5s;
13-
color: #fff;
14-
// top: 0;
15-
// left: 0;
16-
// position: fixed;
17-
}
18-
&-logo{
19-
width: 11rem;
20-
}
21-
&-menu{
22-
& li {
23-
display: inline-block;
24-
list-style: none;
25-
margin: 5px 20px;
26-
font-size: 1rem;
27-
}
21+
}
22+
&-logo {
23+
width: 11rem;
24+
}
25+
&-menu {
26+
& li {
27+
display: inline-block;
28+
list-style: none;
29+
margin: 5px 20px;
30+
font-size: 1rem;
2831
}
32+
}
2933
}
3034

31-
.link-default{
32-
color: inherit;
33-
font-size: inherit;
34-
text-decoration: inherit;
35+
.link-default {
36+
color: inherit;
37+
font-size: inherit;
38+
text-decoration: inherit;
3539
}
36-
37-

0 commit comments

Comments
 (0)