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

Commit

Permalink
feat(style): improve breadcrumb (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre authored May 30, 2022
1 parent 37cdf92 commit df30e41
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
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

0 comments on commit df30e41

Please sign in to comment.