Skip to content

Commit

Permalink
feat: blank pages, folder structure and active links
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudambro committed Aug 4, 2023
1 parent 8abe6b3 commit ad99b64
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 63 deletions.
10 changes: 5 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
webpack: config => {
webpack: (config) => {
config.module.rules.push({
test: /\.woff2$/,
type: "asset/resource"
});
return config;
}
type: "asset/resource",
})
return config
},
}

module.exports = nextConfig
9 changes: 9 additions & 0 deletions src/app/(la-fabrique)/about/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function About() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>À propos de la Fabrique</h1>
</section>
)
}
9 changes: 9 additions & 0 deletions src/app/(la-fabrique)/equipe/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function Team() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>L'équipe</h1>
</section>
)
}
9 changes: 9 additions & 0 deletions src/app/(la-fabrique)/notre-offre/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function NotreOffre() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>Ce que vous offre de la Fabrique</h1>
</section>
)
}
9 changes: 9 additions & 0 deletions src/app/documentation/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function Documentation() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>Documentation</h1>
</section>
)
}
Binary file removed src/app/favicon.ico
Binary file not shown.
26 changes: 16 additions & 10 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import "./globals.css"
import type { Metadata } from "next"

import { defaultColorScheme } from "./defaultColorScheme"
import Link from "next/link"
import { DsfrHead } from "@codegouvfr/react-dsfr/next-appdir/DsfrHead"
import { DsfrProvider } from "@codegouvfr/react-dsfr/next-appdir/DsfrProvider"
import { getHtmlAttributes } from "@codegouvfr/react-dsfr/next-appdir/getHtmlAttributes"
import { StartDsfr } from "./StartDsfr"

import Link from "next/link"
import Header from "./components/Header"
import Footer from "./components/Footer"
import "@/styles/globals.css"
import { defaultColorScheme } from "@/styles/defaultColorScheme"
import { StartDsfr } from "@/components/StartDsfr"
import Header from "@/components/Header"
import Footer from "@/components/Footer"

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "La Fabrique des Ministères Sociaux",
description:
"La fabrique numérique des ministères sociaux reprend la démarche et les grands principes de beta.gouv, à savoir : Un leitmotiv : la résolution d'irritants...",
}

export default function RootLayout({
Expand All @@ -22,6 +22,7 @@ export default function RootLayout({
children: React.ReactNode
}) {
const lang = "fr"

return (
<html {...getHtmlAttributes({ defaultColorScheme, lang })}>
<head>
Expand All @@ -45,7 +46,12 @@ export default function RootLayout({
<body>
<DsfrProvider lang={lang}>
<Header />
{children}
<main
id="contenu"
className="flex min-h-screen flex-col items-center justify-between p-24"
>
{children}
</main>
<Footer />
</DsfrProvider>
</body>
Expand Down
13 changes: 6 additions & 7 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { fr } from "@codegouvfr/react-dsfr"

export default function Home() {
return (
<main
id="contenu"
className="flex min-h-screen flex-col items-center justify-between p-24"
>
<section className={fr.cx("fr-h1")}>
<h1>Santé, Solidarité, Travail: nos startups à votre service</h1>
<>
<section>
<h1 className={fr.cx("fr-h1")}>
Santé, Solidarité, Travail: nos startups à votre service
</h1>
</section>
</main>
</>
)
}
9 changes: 9 additions & 0 deletions src/app/proposez-vous-idees/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function ProposezVosIdees() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>Proposez vos idées</h1>
</section>
)
}
9 changes: 9 additions & 0 deletions src/app/recrutement/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function Recrutement() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>Recrutement</h1>
</section>
)
}
9 changes: 9 additions & 0 deletions src/app/startups/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fr } from "@codegouvfr/react-dsfr"

export default function Startups() {
return (
<section>
<h1 className={fr.cx("fr-h1")}>Nos startups</h1>
</section>
)
}
11 changes: 7 additions & 4 deletions src/app/components/Footer.tsx → src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import {
type FooterProps,
} from "@codegouvfr/react-dsfr/Footer"

import { items as navigationItems } from "./Navigation"
import { navigationItems, quickAccessItems } from "@/utils/navigationItems"

const otherLinks: FooterProps.LinkList.Column = {
categoryName: "Autres",
links: navigationItems.filter(
(item) => !item.menuLinks
) as FooterProps.LinkList.Links,
links: [
...(navigationItems.filter(
(item) => !item.menuLinks
) as FooterProps.LinkList.Links),
...(quickAccessItems as unknown as FooterProps.LinkList.Link[]),
].slice(0, 8) as FooterProps.LinkList.Links,
}

const navigationToFooterLinkList: FooterProps.LinkList.List = [
Expand Down
13 changes: 3 additions & 10 deletions src/app/components/Header.tsx → src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Navigation from "./Navigation"
import { Header as DSFRHeader } from "@codegouvfr/react-dsfr/Header"
import { quickAccessItems } from "@/utils/navigationItems"
import Navigation from "./Navigation"

export default function Header() {
return (
Expand All @@ -18,15 +19,7 @@ export default function Header() {
}}
id="fr-header-header-with-quick-access-items-nav-items-and-search-engine"
navigation={<Navigation />}
quickAccessItems={[
{
iconId: "fr-icon-file-text-line",
linkProps: {
href: "/documentation",
},
text: "Documentation",
},
]}
quickAccessItems={quickAccessItems}
serviceTagline="Un incubateur betagouv 🥸"
serviceTitle="La Fabrique des Ministères Sociaux"
/>
Expand Down
43 changes: 43 additions & 0 deletions src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use client"
import { useMemo } from "react"
import { usePathname, useSearchParams } from "next/navigation"
import {
MainNavigation,
type MainNavigationProps,
} from "@codegouvfr/react-dsfr/MainNavigation"
import { navigationItems } from "@/utils/navigationItems"

export default function Navigation() {
const pathname = usePathname()
const searchParams = useSearchParams().toString()

const activeNavigationItems = useMemo(() => {
const currentUrl = `${pathname}${searchParams ? `?${searchParams}` : ""}`
const activeNavigationItems = navigationItems.map(
(item: MainNavigationProps.Item) => {
if (item.menuLinks?.length) {
let isActive = false
const activeMenuLinks = item.menuLinks.map((menuLink) => {
const menuLinkIsActive =
currentUrl === (menuLink.linkProps.href as string)
if (menuLinkIsActive) isActive = true
return { ...menuLink, isActive: menuLinkIsActive }
})

return { ...item, isActive, menuLinks: activeMenuLinks }
}
if (!item.linkProps) return item
return {
...item,
isActive: pathname.startsWith(item.linkProps.href as string),
}
}
)
return activeNavigationItems
}, [pathname, searchParams])

// Warning: Prop `id` did not match. Server: "main-navigation-:Rt6cq:-button-0" Client: "main-navigation-:R3kpj9:-button-0"
// https://github.com/vercel/next.js/issues/53110

return <MainNavigation items={activeNavigationItems} />
}
4 changes: 2 additions & 2 deletions src/app/StartDsfr.tsx → src/components/StartDsfr.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"

import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir"
import { defaultColorScheme } from "./defaultColorScheme"
import Link from "next/link"
import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir"
import { defaultColorScheme } from "@/styles/defaultColorScheme"

declare module "@codegouvfr/react-dsfr/next-appdir" {
interface RegisterLink {
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion src/app/globals.css → src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb)))
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
40 changes: 23 additions & 17 deletions src/app/components/Navigation.tsx → src/utils/navigationItems.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
import {
MainNavigation,
type MainNavigationProps,
} from "@codegouvfr/react-dsfr/MainNavigation"
import { type MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation"
import { type HeaderProps } from "@codegouvfr/react-dsfr/Header"

export const items: MainNavigationProps.Item[] = [
const navigationItems: MainNavigationProps.Item[] = [
{
menuLinks: [
{
linkProps: {
href: "#",
href: "/startups?categorie=travail",
target: "_self",
},
text: "Travail",
},
{
linkProps: {
href: "#",
href: "/startups?categorie=solidarites",
target: "_self",
},
text: "Solidarités",
},
{
linkProps: {
href: "#",
href: "/startups?categorie=sante",
target: "_self",
},
text: "Santé",
},
{
linkProps: {
href: "#",
href: "/startups",
target: "_self",
},
text: "Tout voir",
Expand All @@ -41,21 +39,21 @@ export const items: MainNavigationProps.Item[] = [
menuLinks: [
{
linkProps: {
href: "#",
href: "/about",
target: "_self",
},
text: "À propos",
},
{
linkProps: {
href: "#",
href: "/notre-offre",
target: "_self",
},
text: "Notre offre",
},
{
linkProps: {
href: "#",
href: "/equipe",
target: "_self",
},
text: "L'équipe",
Expand All @@ -65,20 +63,28 @@ export const items: MainNavigationProps.Item[] = [
},
{
linkProps: {
href: "#",
href: "/proposez-vous-idees",
target: "_self",
},
text: "Proposez vos idées",
},
{
linkProps: {
href: "#",
href: "/recrutement",
target: "_self",
},
text: "Recrutement",
},
]

export default function Navigation() {
return <MainNavigation items={items} />
}
const quickAccessItems: HeaderProps.QuickAccessItem[] = [
{
iconId: "fr-icon-file-text-line",
linkProps: {
href: "/documentation",
},
text: "Documentation",
},
]

export { navigationItems, quickAccessItems }
12 changes: 6 additions & 6 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
Expand Down
Loading

0 comments on commit ad99b64

Please sign in to comment.