diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-09 15:40:16 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-09 15:40:16 +0700 |
| commit | be0f537dc4fe384eef09436833c6407e6482c16d (patch) | |
| tree | 194b1ad3f34396cb8149075bbbd38b854aedf361 /src/modules/profile-card/components | |
| parent | 5d5401ae36e7e0c8eb38ccd943c1aa44a9573d35 (diff) | |
Initial commit
Diffstat (limited to 'src/modules/profile-card/components')
| -rw-r--r-- | src/modules/profile-card/components/Dropdown.tsx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/modules/profile-card/components/Dropdown.tsx b/src/modules/profile-card/components/Dropdown.tsx new file mode 100644 index 0000000..f6f58c9 --- /dev/null +++ b/src/modules/profile-card/components/Dropdown.tsx @@ -0,0 +1,36 @@ +"use client"; +import { DropdownItem, DropdownMenu, DropdownTrigger, Dropdown as UIDropdown } from "@nextui-org/react" +import { MoreVerticalIcon } from "lucide-react" +import { deleteCookie } from "cookies-next" +import { useRouter } from "next/navigation"; + +const Dropdown = () => { + const router = useRouter() + + const logout = () => { + deleteCookie('credential') + router.push('/login') + } + + return ( + <UIDropdown> + <DropdownTrigger> + <button type="button" className="p-1"> + <MoreVerticalIcon size={20} /> + </button> + </DropdownTrigger> + <DropdownMenu> + <DropdownItem + key="logout" + className="text-danger-600" + color="danger" + onPress={logout} + > + Logout + </DropdownItem> + </DropdownMenu> + </UIDropdown> + ) +} + +export default Dropdown
\ No newline at end of file |
