Skip to content

Commit

Permalink
Merge pull request #65 from 202306-NEA-DZ-FEW/5-navbar
Browse files Browse the repository at this point in the history
5 navbar
  • Loading branch information
ismail-benlaredj authored Oct 25, 2023
2 parents dfccb29 + 5239598 commit dd8b246
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 1 deletion.
5 changes: 5 additions & 0 deletions public/images/account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/images/ar-flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions public/images/en-flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions src/components/navbar/AccountMenu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";
import { BiLogOut } from "react-icons/bi";
import { MdAccountCircle } from "react-icons/md";

const AccountMenu = ({ logout }) => {
const [openMenu, setOpenMenu] = useState(false);

return (
<div className='relative items-center justify-end hidden md:flex '>
<button
onClick={() => setOpenMenu(!openMenu)}
className='text-base font-medium text-black whitespace-nowrap hover:text-green'
>
<Image
src='/images/account.svg'
width={36}
height={36}
alt='account'
/>
</button>
<div
className={`${
openMenu ? "block" : "hidden"
} absolute top-[115%] -right-4 transition p-3 w-48 h-fit bg-white shadow-lg rounded-lg`}
>
<div className='flex flex-col gap-4'>
<Link
href='/account'
className=' text-black whitespace-nowrap hover:text-green'
>
<div className='flex flex-row items-center gap-3'>
<MdAccountCircle className='text-3xl ' />
<span className='text-lg font-medium'>
Your account
</span>
</div>
</Link>
<button
onClick={logout}
className='text-red whitespace-nowrap hover:opacity-75'
>
<div className='flex flex-row items-center gap-4 '>
<BiLogOut className='text-3xl -ml-1' />
<span className='text-lg font-medium '>
Log Out
</span>
</div>
</button>
</div>
</div>
</div>
);
};

export default AccountMenu;
75 changes: 75 additions & 0 deletions src/components/navbar/LanguageMenu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";

const LanguageMenu = () => {
const [language, setLanguage] = useState("en");
const [openMenu, setOpenMenu] = useState(false);

return (
<div className='relative items-center justify-end hidden md:flex '>
<button
onClick={() => setOpenMenu(!openMenu)}
className='text-base font-medium text-black whitespace-nowrap hover:text-green'
>
<Image
src={`/images/${language}-flag.svg`}
width={36}
height={36}
alt={language == "en" ? "English" : "Arabic"}
/>
</button>
<div
className={`${
openMenu ? "block" : "hidden"
} absolute top-[115%] -right-4 transition p-3 w-48 h-fit bg-white shadow-lg rounded-lg`}
>
<div className='flex flex-col gap-4'>
<Link
href='/'
locale='en'
className=' text-black whitespace-nowrap hover:text-green'
>
<div
className='flex flex-row items-center gap-5'
onClick={() => {
setLanguage("en");
setOpenMenu(false);
}}
>
<Image
src='/images/en-flag.svg'
width={36}
height={36}
alt='English'
/>
<span className='text-lg font-medium'>English</span>
</div>
</Link>
<Link
href='/'
locale='ar'
className=' text-base font-medium text-black whitespace-nowrap hover:text-green'
>
<div
className='flex flex-row items-center gap-5'
onClick={() => {
setLanguage("ar");
setOpenMenu(false);
}}
>
<Image
src='/images/ar-flag.svg'
width={36}
height={36}
alt='Arabic'
/>
<span className='text-xl font-medium'>العربية</span>
</div>
</Link>
</div>
</div>
</div>
);
};
export default LanguageMenu;
Loading

0 comments on commit dd8b246

Please sign in to comment.