Skip to content

Commit

Permalink
chore: move no result element to component file
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricss committed Nov 30, 2024
1 parent f6b9d4b commit 6d4e790
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
25 changes: 25 additions & 0 deletions app/espace-laureat/_components/AucunDossier.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export function AucunDossier({
siret,
email,
noResultMsg,
}: {
siret: string;
email: string;
noResultMsg: string;
}) {
return (
<div className="flex flex-col gap-y-6 text-center items-center justify-center border w-full h-96">
<span
className="text-gray-900 fr-icon-warning-fill fr-icon--lg"
aria-hidden="true"
></span>
<h2 className="text-lg max-w-lg mb-0">
Aucun dossier n'est associé à l'adresse email {email} et au siret{" "}
{siret}
</h2>
<p className="max-w-3xl mb-0 text-gray-700 text-balance">
{noResultMsg}
</p>
</div>
);
}
21 changes: 7 additions & 14 deletions app/espace-laureat/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AucunDossier } from "@/app/espace-laureat/_components/AucunDossier";
import { Connexion } from "@/app/espace-laureat/_components/Connexion";
import { DossierSection } from "@/app/espace-laureat/_components/DossierSection";
import { getDossier } from "@/app/espace-laureat/_components/getDossier";
Expand Down Expand Up @@ -47,24 +48,16 @@ export default async function EspaceLaureat({
<h1>{getPageTitle({ successDossiersLength: successDossiers.length })}</h1>

{successDossiers.length === 0 ? (
<div className="flex flex-col gap-y-6 text-center items-center justify-center border w-full h-96">
<span
className="text-gray-900 fr-icon-warning-fill fr-icon--lg"
aria-hidden="true"
></span>
<h2 className="text-lg max-w-lg mb-0">
Aucun dossier n'est associé à l'adresse email {user.email} et au
siret {siret}
</h2>
<p className="max-w-3xl mb-0 text-gray-700 text-balance">
{noResultMsg}
</p>
</div>
<AucunDossier
siret={siret}
email={user.email}
noResultMsg={noResultMsg}
/>
) : (
<div className="flex flex-col gap-y-8">
{successDossiers.map((dossier, index) => (
<DossierSection key={index} dossier={dossier} />
))}{" "}
))}
</div>
)}

Expand Down

0 comments on commit 6d4e790

Please sign in to comment.