Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"/Users/victorbruce/Projects/web-development/next-starter/tailwind.config.js":"1"},{"size":776,"mtime":1663665473166,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"d63bkn","/Users/victorbruce/Projects/web-development/next-starter/tailwind.config.js",[],[]]
[{"/Users/victorbruce/Projects/web-development/next-starter/tailwind.config.js":"1"},{"size":871,"mtime":1663845585796,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"d63bkn","/Users/victorbruce/Projects/web-development/next-starter/tailwind.config.js",[],[]]
2 changes: 1 addition & 1 deletion src/components/DropDown/LanguageSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const LanguageSwitcher = () => {
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="absolute right-0 z-10 mt-2 w-36 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<Menu.Items className="absolute -top-24 md:top-10 right-0 z-10 mt-2 w-36 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<div className="py-1">
{locales?.map((l) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/DropDown/ToggleThemeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const DropDown = (): JSX.Element | null => {
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="absolute right-0 z-10 mt-2 w-36 origin-top-right rounded-md bg-dropdownBg shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ">
<Menu.Items className="absolute -top-32 md:top-10 right-0 z-10 mt-2 w-36 origin-top-right rounded-md bg-dropdownBg shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ">
<div className="py-1">
<Menu.Item>
{({ active }) => (
Expand Down
1 change: 1 addition & 0 deletions src/layouts/AppLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ReactNode } from "react";
// components
import Navigation from "layouts/Navigation";


interface AppLayoutProps {
children: ReactNode;
}
Expand Down
48 changes: 46 additions & 2 deletions src/layouts/Navigation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useState } from "react";
import Link from "next/link";

import { Bars2Icon, XMarkIcon } from "@heroicons/react/20/solid";
// components
import ToggleThemeButton from "components/DropDown/ToggleThemeButton";
import LanguageSwitcher from "components/DropDown/LanguageSwitcher";

const Navigation = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
return (
<header className="w-full sticky top-0 z-[1000px] border-b border-borderColor backdrop-blur">
<nav className="max-w-7xl px-4 mx-auto flex justify-between items-center h-[80px]">
Expand All @@ -18,14 +20,56 @@ const Navigation = () => {
</a>
</Link>
</div>
<ul className="flex gap-4 items-center ">
{isMenuOpen ? (
<button
className="transition focus:duration-150 focus:outline-none outline-none"
onClick={() => setIsMenuOpen((prevState) => !prevState)}
>
<XMarkIcon className="w-6 h-6 md:hidden" />
</button>
) : (
<button
className="transition focus:duration-150 focus:outline-none outline-none"
onClick={() => setIsMenuOpen((prevState) => !prevState)}
>
<Bars2Icon className="w-6 h-6 md:hidden" />
</button>
)}

{/** Desktop */}
<ul className="gap-4 items-center hidden md:flex">
<li className="border-r-2 border-borderColor px-4 flex justify-center items-center">
<ToggleThemeButton />
</li>
<li>
<LanguageSwitcher />
</li>
</ul>

{/** Mobile */}
{isMenuOpen && (
<div className="absolute top-[82px] left-0 right-0 bottom-0 h-screen">
<div className="bg-pageBg relative w-100 h-[80vh] py-8 px-4 overflow-y-auto">
<nav>
<ul className="flex flex-col gap-4">
<li>
<Link href="/">About</Link>
</li>
</ul>
</nav>
<div className="border-borderColor border-t absolute left-0 right-0 bottom-0 px-4 py-4">
<div className="flex justify-between items-center mb-4">
<span>Switch theme:</span>
<ToggleThemeButton />
</div>
<div className="flex justify-between items-center">
<span>Switch language:</span>
<LanguageSwitcher />
</div>
</div>
</div>
</div>
)}
</nav>
</header>
);
Expand Down