mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
feat(AppHeader): add notifications click handler and count display
This commit is contained in:
@@ -255,6 +255,8 @@ export function PortalLayout() {
|
||||
userName={displayName || t("app.name")}
|
||||
userInitials={initials}
|
||||
supportedLanguages={SUPPORTED_LANGUAGES}
|
||||
onNotificationsClick={() => navigate("/notifications")}
|
||||
notificationCount={unseen?.count}
|
||||
/>
|
||||
</AppShell.Header>
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ interface AppHeaderProps {
|
||||
userName?: string;
|
||||
userInitials?: string;
|
||||
supportedLanguages: readonly string[];
|
||||
onNotificationsClick?: () => void;
|
||||
notificationCount?: number;
|
||||
}
|
||||
|
||||
export function AppHeader({
|
||||
@@ -46,6 +48,8 @@ export function AppHeader({
|
||||
userName = 'User',
|
||||
userInitials = '?',
|
||||
supportedLanguages,
|
||||
onNotificationsClick,
|
||||
notificationCount,
|
||||
}: AppHeaderProps) {
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768;
|
||||
|
||||
@@ -201,9 +205,17 @@ export function AppHeader({
|
||||
e.currentTarget.style.boxShadow =
|
||||
'0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.06)';
|
||||
}}
|
||||
onClick={onNotificationsClick}
|
||||
aria-label="Notifications"
|
||||
>
|
||||
<Indicator color="red" size={9} offset={5} withBorder>
|
||||
<Indicator
|
||||
color="red"
|
||||
size={notificationCount ? 16 : 9}
|
||||
offset={notificationCount ? 2 : 5}
|
||||
withBorder
|
||||
disabled={notificationCount === 0}
|
||||
label={notificationCount || undefined}
|
||||
>
|
||||
<IconBell size={19} />
|
||||
</Indicator>
|
||||
</UnstyledButton>
|
||||
|
||||
Reference in New Issue
Block a user