Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update gear icon to logout icon #499

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/selfish-rules-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin": patch
---

feat: update gear icon to logout icon (#460)
52 changes: 10 additions & 42 deletions packages/next-admin/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
TransitionChild,
} from "@headlessui/react";
import {
ArrowRightEndOnRectangleIcon,
ArrowTopRightOnSquareIcon,
Bars3Icon,
XMarkIcon,
Expand All @@ -15,9 +16,7 @@
import Link from "next/link";
import { Fragment, useState } from "react";

import { Cog6ToothIcon, PowerIcon } from "@heroicons/react/24/solid";
import { useTheme } from "next-themes";
import Image from "next/image";
import { useConfig } from "../context/ConfigContext";
import { useI18n } from "../context/I18nContext";
import { useRouterInternal } from "../hooks/useRouterInternal";
Expand All @@ -31,15 +30,6 @@
import Divider from "./Divider";
import ResourceIcon from "./common/ResourceIcon";
import Button from "./radix/Button";
import {
Dropdown,
DropdownBody,
DropdownContent,
DropdownItem,
DropdownLabel,
DropdownSeparator,
DropdownTrigger,
} from "./radix/Dropdown";

const ColorSchemeSwitch = dynamic(() => import("./ColorSchemeSwitch"), {
ssr: false,
Expand Down Expand Up @@ -172,7 +162,7 @@
<div className="text-nextadmin-menu-color dark:text-dark-nextadmin-menu-color flex flex-1 items-center gap-1 px-2 py-3 text-sm font-semibold leading-6">
<div className="flex min-w-0 flex-1 items-center gap-3">
{user.data.picture ? (
<img

Check warning on line 165 in packages/next-admin/src/components/Menu.tsx

View workflow job for this annotation

GitHub Actions / start

Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element
width={32}
height={32}
className="flex h-8 w-8 flex-shrink-0 rounded-full"
Expand All @@ -192,37 +182,15 @@
{user.data.name}
</span>
</div>
{hasDropdown && (
<Dropdown>
<DropdownTrigger asChild>
<Button
variant="ghost"
size="sm"
className="flex-grow-1 order-2 flex-shrink-0 basis-auto !px-2 py-2"
>
<Cog6ToothIcon className="h-6 w-6" />
</Button>
</DropdownTrigger>
<DropdownBody>
<DropdownContent side="top" sideOffset={5} className="px-1 py-2">
<DropdownLabel className="text-nextadmin-content-inverted dark:text-dark-nextadmin-content-inverted px-4 py-1 font-normal">
{user.data.name}
</DropdownLabel>
<DropdownSeparator className="bg-nextadmin-border-default dark:bg-dark-nextadmin-border-emphasis" />
<DropdownItem asChild>
<button
type="button"
onClick={logoutBind}
className="text-nextadmin-content-inverted dark:text-dark-nextadmin-content-inverted hover:text-nextadmin-content-emphasis hover:bg-nextadmin-background-muted dark:hover:text-dark-nextadmin-content-inverted dark:hover:bg-dark-nextadmin-background-muted flex items-center gap-2 rounded px-4 py-1 font-medium"
>
<PowerIcon className="h-4 w-4" />
<span>{t("user.logout")}</span>
</button>
</DropdownItem>
</DropdownContent>
</DropdownBody>
</Dropdown>
)}
<Button
variant="ghost"
size="sm"
className="flex-grow-1 order-2 flex-shrink-0 basis-auto !px-2 py-2"
type="button"
onClick={logoutBind}
>
<ArrowRightEndOnRectangleIcon className="h-6 w-6" />
</Button>
</div>
);
};
Expand Down
Loading