Skip to content

Commit

Permalink
feat: add menu icon
Browse files Browse the repository at this point in the history
  • Loading branch information
loicguillois committed Jan 6, 2025
1 parent 373ec3e commit 73e17df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Header/SmallHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function SmallHeader() {
linkProps: {
to: link.url
},
text: <>{link.label} {link.showNewBadge && <Badge small={true} severity='success' noIcon={true} className="fr-ml-1w">Nouveau</Badge>}</>,
isActive: location.pathname.startsWith(link.url)
text: <><span className={link.icon} aria-hidden="true"></span> {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
11 changes: 6 additions & 5 deletions frontend/src/models/UserNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ export interface UserNavItem {
url: string;
label: string;
showNewBadge?: boolean;
icon: string;
}

export const getUserNavItem = (userNavItem: UserNavItems): UserNavItem => {
switch (userNavItem) {
case UserNavItems.Campaign:
return { url: '/campagnes', label: 'Campagnes' };
return { url: '/campagnes', label: 'Campagnes', icon: 'fr-icon-mail-line' };
case UserNavItems.HousingList:
return { url: '/parc-de-logements', label: 'Parc de logements' };
return { url: '/parc-de-logements', label: 'Parc de logements', icon: 'fr-icon-building-line' };
case UserNavItems.Resources:
return { url: '/ressources', label: 'Ressources' };
return { url: '/ressources', label: 'Ressources', icon: 'fr-icon-information-line' };
case UserNavItems.Analysis:
return { url: '/analyses', label: 'Analyses', showNewBadge: true };
return { url: '/analyses', label: 'Analyses', showNewBadge: true, icon: 'fr-icon-bar-chart-box-line' };
default:
return { url: '/', label: 'Accueil' };
return { url: '/', label: 'Accueil', icon: 'fr-icon-building-line' };
}
};

0 comments on commit 73e17df

Please sign in to comment.