I'm looking to align a list to the right in my navbar, as shown in the image below
Here's my navbar.js code:
import React from "react";
import "./Navbar.css";
const Navbar = ({ isScrolling, information }) => {
const toTheTop = () => {
window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
};
return (
<nav className={`navbar ${isScrolling > 20 ? "scrolling" : null}`}>
<div
className={`navbar-logo ${
isScrolling > 20 ? "scrolling-logo" : null
}`}
onClick={toTheTop}
>
<p>{information.name}</p>
</div>
<div
className={`navbar-links box ${
isScrolling > 20 ? "scrolling-links" : null
}`}
>
<ul>
{information.directions.map((direction) => (
<li key={direction.key}>
<a href={direction.url}>{direction.name}</a>
</li>
))}
</ul>
</div>
</nav>
);
};
export default Navbar;
And here's my Navbar.css styling:
.navbar {
display: flex;
position: fixed;
top: 0;
background-color: transparent;
width: 100%;
height: 80px;
font-size: 20px;
z-index: 1;
}
.scrolling {
background-color: #000;
transition: all 0.5s ease;
}
.navbar-logo {
display: flex;
align-items: center;
padding-left: 50px;
color: #000;
cursor: pointer;
}
/* additional styles for list alignment */
.navbar-links {
display: flex;
align-items: center;
justify-content: flex-end;
}
.navbar-links > ul {
display: flex;
flex-direction: row;
list-style: none;
}
.navbar-links > ul > li {
padding: 0 5%;
}
.navbar-links > ul > li > a {
color: #000;
}
/* additional styling for scrolling */
.scrolling-links > ul > li > a {
color: #fff;
transition: all 0.5s ease;
}
Feel free to check out the code for my project on my GitHub repository https://github.com/Michael-Liendo/michaelliendo.com