Files
labelmain-demo/components/layout/components/ClientIcon.tsx
2026-05-14 15:12:32 +08:00

52 lines
1.2 KiB
TypeScript

import {
IconCategory2,
IconCube3dSphere,
IconFileText,
IconFolder,
IconFolders,
IconHierarchy3,
IconLayoutDashboard,
IconPhoto,
IconReportMedical,
IconSettings,
IconUserCircle,
IconUsersGroup,
IconVideo,
} from "@tabler/icons-react"
import React from "react"
const iconMap = {
DashboardIcon: IconLayoutDashboard,
EmployeeManagementIcon: IconUsersGroup,
ImageAnnotationIcon: IconPhoto,
LidarAnnotationIcon: IconCube3dSphere,
ManagementCenterIcon: IconSettings,
MyProjectsIcon: IconFolder,
PersonalCenterIcon: IconUserCircle,
ProjectCategoryIcon: IconCategory2,
ProjectManagementIcon: IconFolders,
ReportIcon: IconFileText,
WorkloadIcon: IconReportMedical,
TeamManagementIcon: IconHierarchy3,
VideoAnnotationIcon: IconVideo,
SystemIcon: IconSettings,
PersonalMenuIcon: IconUserCircle,
TaskMenuIcon: IconLayoutDashboard,
AuthMenuIcon: IconFileText,
} as const
export const ClientIcon = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"button"> & {
icon?: string
}
>(({ icon, ...props }, _ref) => {
if (icon) {
const IconComponent = iconMap[icon as keyof typeof iconMap]
return IconComponent ? <IconComponent style={{ ...props.style }} /> : null
} else {
return null
}
})