Skip to content

Commit

Permalink
feat: use filled icon variants
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rw committed Jan 5, 2025
1 parent 461c21e commit f7de637
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
53 changes: 30 additions & 23 deletions apps/nextjs/src/app/[locale]/manage/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import type { PropsWithChildren } from "react";
import { AppShellMain } from "@mantine/core";
import {
IconAffiliateFilled,
IconBook2,
IconBox,
IconBrandDiscord,
IconBrandDocker,
IconBrandGithub,
IconBrandTablerFilled,
IconClipboardListFilled,
IconDirectionsFilled,
IconGitFork,
IconHome,
IconInfoSmall,
IconLayoutDashboard,
IconLogs,
IconHelpSquareRoundedFilled,
IconHomeFilled,
IconInfoSquareRoundedFilled,
IconLayoutDashboardFilled,
IconMailForward,
IconPhoto,
IconPlug,
IconQuestionMark,
IconReport,
IconPhotoFilled,
IconPointerFilled,
IconSearch,
IconSettings,
IconTool,
IconUser,
IconSettingsFilled,
IconUserFilled,
IconUsers,
IconUsersGroup,
} from "@tabler/icons-react";
Expand All @@ -40,11 +41,11 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
const navigationLinks: NavigationLink[] = [
{
label: t("items.home"),
icon: IconHome,
icon: IconHomeFilled,
href: "/manage",
},
{
icon: IconLayoutDashboard,
icon: IconLayoutDashboardFilled,
href: "/manage/boards",
label: t("items.boards"),
},
Expand All @@ -53,9 +54,12 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
href: "/manage/apps",
label: t("items.apps"),
hidden: !session,
iconProps: {
strokeWidth: 2.5,
},
},
{
icon: IconPlug,
icon: IconAffiliateFilled,
href: "/manage/integrations",
label: t("items.integrations"),
hidden: !session,
Expand All @@ -65,15 +69,18 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
href: "/manage/search-engines",
label: t("items.searchEngies"),
hidden: !session,
iconProps: {
strokeWidth: 2.5,
},
},
{
icon: IconPhoto,
icon: IconPhotoFilled,
href: "/manage/medias",
label: t("items.medias"),
hidden: !session,
},
{
icon: IconUser,
icon: IconUserFilled,
label: t("items.users.label"),
hidden: !session?.user.permissions.includes("admin"),
items: [
Expand All @@ -97,7 +104,7 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
},
{
label: t("items.tools.label"),
icon: IconTool,
icon: IconPointerFilled,
// As permissions always include there children permissions, we can check other-view-logs as admin includes it
hidden: !session?.user.permissions.includes("other-view-logs"),
items: [
Expand All @@ -109,19 +116,19 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
},
{
label: t("items.tools.items.api"),
icon: IconPlug,
icon: IconDirectionsFilled,
href: "/manage/tools/api",
hidden: !session?.user.permissions.includes("admin"),
},
{
label: t("items.tools.items.logs"),
icon: IconLogs,
icon: IconBrandTablerFilled,
href: "/manage/tools/logs",
hidden: !session?.user.permissions.includes("other-view-logs"),
},
{
label: t("items.tools.items.tasks"),
icon: IconReport,
icon: IconClipboardListFilled,
href: "/manage/tools/tasks",
hidden: !session?.user.permissions.includes("admin"),
},
Expand All @@ -130,12 +137,12 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
{
label: t("items.settings"),
href: "/manage/settings",
icon: IconSettings,
icon: IconSettingsFilled,
hidden: !session?.user.permissions.includes("admin"),
},
{
label: t("items.help.label"),
icon: IconQuestionMark,
icon: IconHelpSquareRoundedFilled,
items: [
{
label: t("items.help.items.documentation"),
Expand Down Expand Up @@ -165,7 +172,7 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
},
{
label: t("items.about"),
icon: IconInfoSmall,
icon: IconInfoSquareRoundedFilled,
href: "/manage/about",
},
];
Expand Down
9 changes: 5 additions & 4 deletions apps/nextjs/src/components/layout/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { JSX } from "react";
import { AppShellNavbar, AppShellSection, ScrollArea } from "@mantine/core";

import type { TablerIcon } from "@homarr/ui";
import type { TablerIcon, TablerIconProps } from "@homarr/ui";

import type { ClientNavigationLink } from "./navigation-link";
import { CommonNavLink } from "./navigation-link";
Expand All @@ -27,8 +27,8 @@ export const MainNavigation = ({ headerSection, footerSection, links }: MainNavi
return null;
}

const { icon: TablerIcon, ...props } = link;
const Icon = <TablerIcon size={20} stroke={1.5} />;
const { icon: TablerIcon, iconProps, ...props } = link;
const Icon = <TablerIcon size={20} stroke={1.5} {...iconProps} />;
let clientLink: ClientNavigationLink;
if ("items" in props) {
clientLink = {
Expand All @@ -38,7 +38,7 @@ export const MainNavigation = ({ headerSection, footerSection, links }: MainNavi
.map((item) => {
return {
...item,
icon: <item.icon size={20} stroke={1.5} />,
icon: <item.icon size={20} stroke={1.5} {...iconProps} />,
};
}),
} as ClientNavigationLink;
Expand All @@ -56,6 +56,7 @@ export const MainNavigation = ({ headerSection, footerSection, links }: MainNavi
interface CommonNavigationLinkProps {
label: string;
icon: TablerIcon;
iconProps?: TablerIconProps;
hidden?: boolean;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Icon123 } from "@tabler/icons-react";
import type { Icon123, IconProps } from "@tabler/icons-react";

export * from "./src";

export type TablerIcon = typeof Icon123;
export type TablerIconProps = IconProps;

0 comments on commit f7de637

Please sign in to comment.