-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show phase in each startups list item (#1035)
- Loading branch information
1 parent
2976b72
commit bf0131c
Showing
2 changed files
with
51 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
import { Card } from "@codegouvfr/react-dsfr/Card" | ||
import { Badge } from "@codegouvfr/react-dsfr/Badge" | ||
|
||
import getStartups from "./get-startups" | ||
|
||
export default function List() { | ||
const startups = getStartups() | ||
|
||
return ( | ||
<div className="startups-list grid grid-cols-4 gap-6"> | ||
{startups.map(({ id, attributes: { name, pitch } }) => ( | ||
<Card | ||
key={id} | ||
enlargeLink | ||
title={name} | ||
desc={pitch} | ||
linkProps={{ href: `/startups/${id}` }} | ||
imageAlt="image d'illustration de la startup" | ||
imageUrl={`https://beta.gouv.fr/img/startups/${id}.png`} | ||
/> | ||
))} | ||
<div className="startups-list grid grid-cols-4 gap-6 fr-mt-6w"> | ||
{startups.map(({ id, attributes: { name, pitch, phases } }) => { | ||
const phase = phases.pop()?.name | ||
const severity = phase === "success" ? "success" : "info" | ||
|
||
return ( | ||
<Card | ||
key={id} | ||
enlargeLink | ||
title={name} | ||
desc={pitch} | ||
linkProps={{ href: `/startups/${id}` }} | ||
imageAlt="image d'illustration de la startup" | ||
imageUrl={`https://beta.gouv.fr/img/startups/${id}.png`} | ||
start={ | ||
<ul className="fr-badges-group"> | ||
{phase && ( | ||
<li> | ||
<Badge key={1} noIcon severity={severity} small> | ||
{phase === "success" ? "succès" : phase} | ||
</Badge> | ||
</li> | ||
)} | ||
</ul> | ||
} | ||
/> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |