Skip to content

Commit

Permalink
feat: add startups list (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-van-woerkens authored Aug 10, 2023
1 parent 3f46f1e commit aefe1eb
Show file tree
Hide file tree
Showing 6 changed files with 15,170 additions and 8 deletions.
1 change: 1 addition & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonar.exclusions=src/app/startups/startups.json
9 changes: 2 additions & 7 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DsfrProvider } from "@codegouvfr/react-dsfr/next-appdir/DsfrProvider"
import { getHtmlAttributes } from "@codegouvfr/react-dsfr/next-appdir/getHtmlAttributes"

import "@/styles/globals.css"
import { defaultColorScheme } from "@/styles/defaultColorScheme"
// import { defaultColorScheme } from "@/styles/defaultColorScheme"
import { StartDsfr } from "@/components/StartDsfr"
import Header from "@/components/Header"
import Footer from "@/components/Footer"
Expand Down Expand Up @@ -46,12 +46,7 @@ export default function RootLayout({
<body>
<DsfrProvider lang={lang}>
<Header />
<main
id="contenu"
className="flex min-h-screen flex-col items-center justify-between p-24"
>
{children}
</main>
<main>{children}</main>
<Footer />
</DsfrProvider>
</body>
Expand Down
25 changes: 25 additions & 0 deletions src/app/startups/get-startups.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import json from "./startups.json"

export default function getStartups() {
const { data } = json
const excludedPhases = ["transfer", "alumni"]

return data.reduce(
(startups, startup) => {
const {
attributes: { phases },
} = startup

if (
startup.type === "startup" &&
startup.relationships.incubator.data.id === "sgmas" &&
!phases.some((phase) => excludedPhases.includes(phase.name))
) {
startups.push(startup)
}

return startups
},
[] as typeof json.data
)
}
23 changes: 23 additions & 0 deletions src/app/startups/list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Card } from "@codegouvfr/react-dsfr/Card"

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>
)
}
4 changes: 3 additions & 1 deletion src/app/startups/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { fr } from "@codegouvfr/react-dsfr"
import List from "./list"

export default function Startups() {
return (
<section>
<section className={fr.cx("fr-container", "fr-py-6w")}>
<h1 className={fr.cx("fr-h1")}>Nos startups</h1>
<List />
</section>
)
}
Loading

0 comments on commit aefe1eb

Please sign in to comment.