Skip to content

Commit

Permalink
Merge pull request #1064 from MTES-MCT/add-menu-badge
Browse files Browse the repository at this point in the history
feat: show 'NOUVEAU' badge in menu
  • Loading branch information
loicguillois authored Dec 31, 2024
2 parents 981512a + 65a6d9b commit 0a6bbef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/Header/SmallHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
fromEstablishmentDTO,
toEstablishmentDTO
} from '../../models/Establishment';
import Badge from '@codegouvfr/react-dsfr/Badge';

function SmallHeader() {
const dispatch = useAppDispatch();
Expand All @@ -41,7 +42,7 @@ function SmallHeader() {
linkProps: {
to: link.url
},
text: link.label,
text: <>{link.label} {link.showNewBadge && <Badge small={true} severity='success' noIcon={true} className="fr-ml-1w">Nouveau</Badge>}</>,
isActive: location.pathname.startsWith(link.url)
};
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/models/UserNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum UserNavItems {
export interface UserNavItem {
url: string;
label: string;
showNewBadge?: boolean;
}

export const getUserNavItem = (userNavItem: UserNavItems): UserNavItem => {
Expand All @@ -19,7 +20,7 @@ export const getUserNavItem = (userNavItem: UserNavItems): UserNavItem => {
case UserNavItems.Resources:
return { url: '/ressources', label: 'Ressources' };
case UserNavItems.Analysis:
return { url: '/analyses', label: 'Analyses' };
return { url: '/analyses', label: 'Analyses', showNewBadge: true };
default:
return { url: '/', label: 'Accueil' };
}
Expand Down

0 comments on commit 0a6bbef

Please sign in to comment.