feat: Add last sections to Navigation component

This commit is contained in:
Gauthier Daniels 2025-04-18 15:47:03 +02:00
parent 229e28737f
commit 8a393c53bf
2 changed files with 18 additions and 1 deletions

View File

@ -161,6 +161,7 @@ export function Navigation({
onLinkClick?: React.MouseEventHandler<HTMLAnchorElement>; onLinkClick?: React.MouseEventHandler<HTMLAnchorElement>;
}) { }) {
const firstSections = navigation.filter((section) => section.position === "start"); const firstSections = navigation.filter((section) => section.position === "start");
const lastSections = navigation.filter((section) => section.position === "end");
const filteredSections = navigation const filteredSections = navigation
.filter((section) => section.position === "auto" || section.position === undefined) .filter((section) => section.position === "auto" || section.position === undefined)
@ -192,6 +193,12 @@ export function Navigation({
))} ))}
</li> </li>
))} ))}
<li>
<h2 className="font-display font-bold text-base text-slate-900 dark:text-white">{lastSections[0]?.type}</h2>
{lastSections.map((section) => (
<NavigationItem key={section.title} section={section} onLinkClick={onLinkClick} />
))}
</li>
</ul> </ul>
</nav> </nav>
); );

View File

@ -2,12 +2,13 @@ const navigationsTypes = {
GLOBAL: "👋 Général", GLOBAL: "👋 Général",
CERTIFICATIONS: "🎓 Certifications", CERTIFICATIONS: "🎓 Certifications",
DOCUMENTATIONS: "📚 Documentations", DOCUMENTATIONS: "📚 Documentations",
OTHER: "🔗 Autres",
}; };
export type NavigationSection = { export type NavigationSection = {
title: string; title: string;
type: (typeof navigationsTypes)[keyof typeof navigationsTypes]; type: (typeof navigationsTypes)[keyof typeof navigationsTypes];
position: "start" | "auto"; position: "start" | "end" | "auto";
links: NavigationLink[]; links: NavigationLink[];
}; };
@ -47,6 +48,15 @@ export const navigation: NavigationSection[] = [
{ title: "Partages et réutilisations", href: "/docs/communaute/partages", subitems: [] }, { title: "Partages et réutilisations", href: "/docs/communaute/partages", subitems: [] },
], ],
}, },
{
title: "Légal",
type: navigationsTypes.OTHER,
position: "end",
links: [
{ title: "Mentions légales", href: "/mentions-legales", subitems: [] },
{ title: "Politique de confidentialité", href: "/politique-de-confidentialite", subitems: [] },
],
},
{ {
title: "Développeur Web et Web Mobile", title: "Développeur Web et Web Mobile",
type: navigationsTypes.CERTIFICATIONS, type: navigationsTypes.CERTIFICATIONS,