Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

feat(style): improve breadcrumb #195

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions src/components/Admin/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
import Head from "next/head";
import { signOut } from "next-auth/react";
import React from "react";
import Link from "next/link";

const Header = () => (
function Breadcrumbs({ breadcrumbs }) {
return (
<nav
role="navigation"
className="fr-breadcrumb"
aria-label="vous êtes ici :"
>
<ol className="fr-breadcrumb__list">
{breadcrumbs.map((breadcrumb, index) => (
<li key={index}>
{index === breadcrumbs.length - 1 ? (
breadcrumb.text
) : (
<Link href={breadcrumb.link}>
<a className="fr-breadcrumb__link">{breadcrumb.text}</a>
</Link>
)}
</li>
))}
</ol>
</nav>
);
}

const Header = ({
breadcrumbs = [{ link: "/administration-annuaire", text: "Admin" }],
}) => (
<>
<Head>
<meta name="robots" content="noindex" />
Expand All @@ -11,22 +38,7 @@ const Header = () => (
<div className="fr-container fr-my-1w">
<div className="fr-grid-row fr-grid-row--gutters fr-grid-row--center fr-grid-row--middle">
<div className="fr-col-2">
<nav
role="navigation"
className="fr-breadcrumb"
aria-label="vous êtes ici :"
>
<ol className="fr-breadcrumb__list">
<li>
<a
className="fr-breadcrumb__link"
href="/administration-annuaire"
>
Admin
</a>
</li>
</ol>
</nav>
<Breadcrumbs breadcrumbs={breadcrumbs} />
</div>
<div className="fr-col-2 fr-col-offset-8">
<button
Expand Down
7 changes: 6 additions & 1 deletion src/pages/administration-annuaire/psychologists/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ const EditablePsychologist = ({
}) => {
return (
<>
<Header />
<Header
breadcrumbs={[
{ link: "/administration-annuaire", text: "Admin" },
{ link: "/administration-annuaire", text: "Psychologues" },
]}
/>

<div className="fr-container">
<PsychologistForm
Expand Down