import {Circle, Flex, HStack, Image, Menu, MenuButton, MenuItem, MenuList, Stack, Text} from "@chakra-ui/react"; import React from "react"; import {useNavigate} from "react-router-dom"; import {chevronRight, messagesIcon, userIcon} from "../../images/index"; import {snakeCase} from 'change-case'; interface DelightHeaderProps { navItems?: any[], logo?: string, title?: string, messagesEnabled?: boolean, userAvatarEnabled?: boolean, primaryColor?: string, secondaryColor?: string, breadCrumb?: string, userMenuItems?: any[], actionsVariant?: number, } const controlHover: any = { cursor: 'pointer', } enum ActionVariant { VARIANT_TYPE_1 = 1, VARIANT_TYPE_2 = 2 } const DelightHeader = (props: DelightHeaderProps) => { const { logo = "", title = "Header", messagesEnabled = true, userAvatarEnabled = true, secondaryColor = "#000000", primaryColor = "#ffffff", navItems = [], breadCrumb = "", userMenuItems = [], actionsVariant = 1, } = props; const actionIcons: string[] = ["bell", "comment-alt"] const isActive = (path: string) => { return window.location.pathname === path; }; let navigate = useNavigate(); const handleClick = (path: string) => { navigate(`/${snakeCase(path)}`); } return ( <> {/* Left section */} {logo && } {title && {title} {breadCrumb && <> {breadCrumb} } } {/* Center section */} {navItems && {navItems.map((item: any, index: number) => ( <> handleClick(item.path) : undefined} _hover={{ bg: secondaryColor, color: primaryColor, cursor: 'pointer' }}> {item.label} {/* */} {item.hasSubMenu && {item.subMenu.map((subItem: any) => ( handleClick(subItem.path)}> {subItem.label} ))} } ))} } {/* Right section */} {actionsVariant === ActionVariant.VARIANT_TYPE_1 ? {messagesEnabled && } {userAvatarEnabled && {/* Commenting this for now. May use it later */} {/* {userMenuItems && {userMenuItems.map((subItem: any) => ( handleClick(subItem.path)}> {subItem.label} ))} } */} } : actionIcons.length > 0 && {actionIcons.map((icon: string, index: number) => ( ))} } ); }; export default DelightHeader;