Skip to content

Commit

Permalink
Updated Styles, Added ThemeButton
Browse files Browse the repository at this point in the history
  • Loading branch information
dhawal-793 committed May 6, 2023
1 parent 308dbe3 commit df529a4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions components/Navlinks.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
"use client"
'use client'
import { XMarkIcon } from "@heroicons/react/24/solid"

import { usePathname } from "next/navigation"

import { categories } from "../constants"
import NavLink from "./NavLink"
import ThemeButton from "./ThemeButton"

type Props = {
navOpen: boolean,
handleClick: Function,
className: string
}


const Navlinks = ({ navOpen, handleClick, className }: Props) => {
const pathName = usePathname();
const isActive = (path: string) => {
return pathName?.split('/').pop() === path
}
return (

<nav className={`gap-8 pb-5 md:justify-between mx-auto border-gray-300 border-b ${className}`}>
{navOpen && <button className="md:hidden absolute top-6 right-6" onClick={() => handleClick()}>
<XMarkIcon className="text-gray-300 hover:text-red-500 w-8 h-8 cursor-pointer z-50" />
</button>}
{/*
Theme Button
*/}
{navOpen &&
<div className="md:hidden absolute top-5 left-0 w-full px-5 flex justify-between">
<ThemeButton />
<button className="block" onClick={() => handleClick()}>
<XMarkIcon className="text-gray-300 hover:text-red-500 w-8 h-8 cursor-pointer z-50" />
</button>
</div>
}
{categories.map((category) => (
<NavLink key={category} category={category} isActive={isActive(category)} />
))}
Expand Down

0 comments on commit df529a4

Please sign in to comment.