Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add underline hover in the navbar #187

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions frontend/src/components/navbar/index.js
Expand Up @@ -65,7 +65,7 @@ class Navbar extends Component {
return (
<NavbarItem active={false} key={path}>
<Link to="http://gsoc.cloudcv.org" target="_blank">
{path}
<span className="hover-underline-animation">{path}</span>
</Link>
</NavbarItem>
);
Expand All @@ -74,7 +74,7 @@ class Navbar extends Component {
return (
<NavbarItem active={false} key={path}>
<Link to="http://gci.cloudcv.org" target="_blank">
{path}
<span className="hover-underline-animation">{path}</span>
</Link>
</NavbarItem>
);
Expand All @@ -83,7 +83,13 @@ class Navbar extends Component {
let formattedPath = path.toLowerCase().replace(/ /g, "-");
return (
<NavbarItem active={active} key={path}>
<Link to={`/${formattedPath}`}>{path === "" ? "Home" : path}</Link>
<Link to={`/${formattedPath}`}>
{path === "" ? (
<span className="hover-underline-animation">{"Home"}</span>
) : (
<span className="hover-underline-animation">{path}</span>
)}
</Link>
</NavbarItem>
);
});
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/styles/partials/_navbar.scss
Expand Up @@ -73,6 +73,8 @@
color: $secondary-color;
}



a {
display: block;
padding: 0.5 * $gutter-width 0 0.5 * $gutter-width 0;
Expand Down Expand Up @@ -136,3 +138,27 @@
}
}

.hover-underline-animation {
display: inline-block;
position: relative;

margin-top: -80px;
}

.hover-underline-animation::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: $secondary-color;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}

.hover-underline-animation:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}