-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from wizelineacademy/notifications
notifications ui done
- Loading branch information
Showing
6 changed files
with
340 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
interface CloseIconInterface { | ||
size: string; | ||
closeFunction: () => void; | ||
} | ||
const CloseIcon = ({ size, closeFunction }: CloseIconInterface) => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 24 24" | ||
fill="currentColor" | ||
className={size} | ||
onClick={closeFunction} | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default CloseIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Link from "next/link"; | ||
|
||
interface DashboardIconInterface { | ||
path: string; | ||
currentPath: string; | ||
} | ||
const DashboardIcon = ({ path, currentPath }: DashboardIconInterface) => { | ||
const isActive = currentPath === path; | ||
return ( | ||
<Link | ||
href={path} | ||
className={`${isActive ? "bg-primary" : "bg-white transition-all delay-0 hover:scale-[1.175]"} group rounded-full p-2 drop-shadow-lg`} | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth={1.5} | ||
stroke="currentColor" | ||
className={`${isActive ? "text-white" : "text-primary"} h-6 w-6`} | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z" | ||
/> | ||
</svg> | ||
</Link> | ||
); | ||
}; | ||
export default DashboardIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Link from "next/link"; | ||
|
||
interface PIPIconInterface { | ||
path: string; | ||
currentPath: string; | ||
} | ||
const PIPIcon = ({ path, currentPath }: PIPIconInterface) => { | ||
const isActive = currentPath === path; | ||
return ( | ||
<Link | ||
href={path} | ||
className={`${isActive ? "bg-primary" : "bg-white transition-all delay-0 hover:scale-[1.175]"} group rounded-full p-2 drop-shadow-lg`} | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth={1.5} | ||
stroke="currentColor" | ||
className={`${isActive ? "text-white" : "text-primary"} h-6 w-6`} | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z" | ||
/> | ||
</svg> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default PIPIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
"use client"; | ||
import { Menu, Transition } from "@headlessui/react"; | ||
import Link from "next/link"; | ||
import { Fragment, useEffect, useState } from "react"; | ||
import { useRouter } from "next/navigation"; | ||
import { useClerk } from "@clerk/nextjs"; | ||
|
||
interface UserIconInterface { | ||
path: string; | ||
currentPath: string; | ||
} | ||
const UserIcon = ({ path, currentPath }: UserIconInterface) => { | ||
const onSite = currentPath === path; | ||
const [isClicked, setIsClicked] = useState<boolean>(false); | ||
const { signOut } = useClerk(); | ||
const router = useRouter(); | ||
const handleSignOut = () => { | ||
signOut(() => router.push("/sign-in")); | ||
}; | ||
|
||
useEffect(() => { | ||
const onCLickOutsideButton = (e: MouseEvent) => { | ||
if (!(e.target as HTMLElement).closest(".group")) { | ||
setIsClicked(false); | ||
} | ||
}; | ||
document.addEventListener("click", onCLickOutsideButton); | ||
return () => document.removeEventListener("click", onCLickOutsideButton); | ||
}, []); | ||
|
||
return ( | ||
<Menu as="div" className="relative inline-block text-left"> | ||
<Menu.Button | ||
onClick={() => setIsClicked(!isClicked)} | ||
className={`${onSite || isClicked ? "bg-primary" : "bg-white transition-all delay-0 hover:scale-[1.175]"} group rounded-full p-2 drop-shadow-lg`} | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth={1.5} | ||
stroke="currentColor" | ||
className={`${onSite || isClicked ? "text-white" : "text-primary"} h-6 w-6 `} | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" | ||
/> | ||
</svg> | ||
</Menu.Button> | ||
<Transition | ||
as={Fragment} | ||
enter="transition ease-out duration-100" | ||
enterFrom="transform opacity-0 scale-95" | ||
enterTo="transform opacity-100 scale-100" | ||
leave="transition ease-in duration-75" | ||
leaveFrom="transform opacity-100 scale-100" | ||
leaveTo="transform opacity-0 scale-95" | ||
> | ||
<Menu.Items className="absolute right-0 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black/5 focus:outline-none"> | ||
<div className="px-1 py-1 "> | ||
<Menu.Item> | ||
<p className="mx-auto items-center px-2 py-2 text-sm"> | ||
Hola José Carlos! | ||
</p> | ||
</Menu.Item> | ||
</div> | ||
<div className="flex flex-col gap-1 px-1 py-1"> | ||
<Menu.Item disabled={onSite}> | ||
{({ active }) => ( | ||
<Link | ||
href="/profile" | ||
className={`${ | ||
active | ||
? "bg-primary/75 text-white" | ||
: onSite | ||
? "bg-primary text-white" | ||
: "text-gray-900" | ||
} group flex w-full items-center rounded-md px-2 py-2 text-sm`} | ||
> | ||
Ir a perfil | ||
</Link> | ||
)} | ||
</Menu.Item> | ||
<Menu.Item> | ||
{({ active }) => ( | ||
<button | ||
className={`${ | ||
active ? "bg-primary/75 text-white" : "text-gray-900" | ||
} group flex w-full items-center rounded-md px-2 py-2 text-sm`} | ||
> | ||
Cambiar tema | ||
</button> | ||
)} | ||
</Menu.Item> | ||
</div> | ||
<div className="px-1 py-1" onClick={handleSignOut}> | ||
{" "} | ||
<Menu.Item> | ||
{({ active }) => ( | ||
<button | ||
className={`${ | ||
active ? "bg-red-700 text-white" : "text-gray-900" | ||
} group flex w-full items-center rounded-md px-2 py-2 text-sm`} | ||
> | ||
Cerrar sesión | ||
</button> | ||
)} | ||
</Menu.Item> | ||
</div> | ||
</Menu.Items> | ||
</Transition> | ||
</Menu> | ||
); | ||
}; | ||
export default UserIcon; |