import { type ReactNode } from 'react'; import { AppBar as MuiAppBar, Toolbar, Typography, IconButton, type AppBarProps, InputBase, Tabs, Tab, Avatar, Menu as MuiMenu, Box, MenuItem } from '@mui/material'; import { ProfileMenu } from './ProfileMenu'; import ClearIcon from '@mui/icons-material/Clear'; import { Menu as MenuIcon } from '@mui/icons-material'; import LogoutIcon from '@mui/icons-material/Logout'; import Person from '@mui/icons-material/Person'; import clsx from 'clsx'; import './rds-header.scss'; export interface RdsHeaderProps extends Omit { title?: string; logo?: ReactNode; onMenuClick?: () => void; showMenuButton?: boolean; actions?: ReactNode; userName?: string; userShortName?: string; userEmail?: string; searchValue?: string; onSearchChange?: (value: string) => void; searchPlaceholder?: string; tabs?: Array; tabValue?: number; onTabChange?: (value: number) => void; subHeader?: ReactNode; children?: ReactNode; } const RdsHeader = ({ title, logo, onMenuClick, showMenuButton = false, actions, searchValue, onSearchChange, searchPlaceholder, tabs, tabValue, onTabChange, subHeader, children, userName, userShortName, userEmail, ...props }: RdsHeaderProps) => { const colorClass = props.color === 'primary' ? 'rds-header--primary' : props.color === 'secondary' ? 'rds-header--secondary' : props.color === 'transparent' ? 'rds-header--transparent' : undefined; return (
{showMenuButton && ( )} {logo && ( {logo} )} {title} {typeof searchValue === 'string' && typeof onSearchChange === 'function' && (
onSearchChange(e.target.value)} /> {searchValue && ( onSearchChange('')} > )}
)} {userName && userShortName && userEmail ? ( , onClick: () => alert('Profile clicked!') }, { label: 'Logout', icon: , onClick: () => alert('Logout clicked!'), sx: { color: 'var(--rds-error-main)' } } ]} /> ) : ( actions && {actions} )} {children}
{Array.isArray(tabs) && typeof tabValue === 'number' && typeof onTabChange === 'function' && ( onTabChange(v)} textColor="primary" indicatorColor="primary" > {tabs.map((tab, idx) => typeof tab === 'string' ? ( ) : ( )} key={tab.label || idx} /> ) )} )} {subHeader && (
{subHeader}
)}
); }; RdsHeader.displayName = 'RdsHeader'; export default RdsHeader;