Skip to content

Commit

Permalink
Add navbar elements animation util
Browse files Browse the repository at this point in the history
  • Loading branch information
iZooGooD committed Jan 12, 2024
1 parent 1d11392 commit 74d0a6e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
26 changes: 20 additions & 6 deletions src/components/gloabal-navbar/navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './navbar.scss';
import logo from '../../assests/logos/stay_booker_logo.png';
import { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -37,27 +36,42 @@ const Navbar = () => {
</div>
<ul className="list-none hidden md:flex">
<li className="p-4">
<Link to="/" className="uppercase font-medium text-slate-100">
<Link
to="/"
className="uppercase font-medium text-slate-100 hover-underline-animation"
>
Home
</Link>
</li>
<li className="p-4">
<Link to="listings" className="uppercase font-medium text-slate-100">
<Link
to="listings"
className="uppercase font-medium text-slate-100 hover-underline-animation"
>
Booking
</Link>
</li>
<li className="p-4">
<Link to="/" className="uppercase font-medium text-slate-100">
<Link
to="/"
className="uppercase font-medium text-slate-100 hover-underline-animation"
>
About us
</Link>
</li>
<li className="p-4">
{isAuthenticated ? (
<Link to="/" className="uppercase font-medium text-slate-100">
<Link
to="/"
className="uppercase font-medium text-slate-100 hover-underline-animation"
>
My account
</Link>
) : (
<Link to="/" className="uppercase font-medium text-slate-100">
<Link
to="/"
className="uppercase font-medium text-slate-100 hover-underline-animation"
>
Login/Register
</Link>
)}
Expand Down
10 changes: 5 additions & 5 deletions src/components/hamburger-menu/HamburgerMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HamburgerMenu = (props) => {
const { isVisible, onHamburgerMenuToggle, isAuthenticated } = props;
return (
<div
className={`background-brand transition ease-in-out delay-150 ${
className={`background-brand shadow-2xl transition ease-in-out delay-150 ${
isVisible ? 'absolute right-0 w-1/2 top-0 h-screen' : 'hidden'
}`}
>
Expand All @@ -19,22 +19,22 @@ const HamburgerMenu = (props) => {
/>
</div>
<ul className="list-none">
<li className="p-4">
<li className="p-4 hover:bg-sky-700">
<Link to="/" className="uppercase font-medium text-slate-100">
Home
</Link>
</li>
<li className="p-4">
<li className="p-4 hover:bg-sky-700">
<Link to="listings" className="uppercase font-medium text-slate-100">
Booking
</Link>
</li>
<li className="p-4">
<li className="p-4 hover:bg-sky-700">
<Link to="/" className="uppercase font-medium text-slate-100">
About us
</Link>
</li>
<li className="p-4">
<li className="p-4 hover:bg-sky-700">
{isAuthenticated ? (
<Link to="/" className="uppercase font-medium text-slate-100">
My account
Expand Down
3 changes: 2 additions & 1 deletion src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
@tailwind utilities;

@import './styles/constants';
@import './styles/utility';
@import './styles/utility';
@import './components/gloabal-navbar/navbar.scss';
24 changes: 24 additions & 0 deletions src/styles/_utility.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
.background-brand {
background-color: $primary-color;
}

// animations and effects
.hover-underline-animation {
display: inline-block;
position: relative;
}

.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 .3s ease-in;
}

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

0 comments on commit 74d0a6e

Please sign in to comment.