-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
7,869 additions
and
314 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Metadata, ResolvingMetadata } from 'next' | ||
import { notFound } from 'next/navigation' | ||
import React from 'react' | ||
import { categories } from 'data/categories' | ||
import Category from 'components/outils/CategoryPage' | ||
import Outil from 'components/outils/Outil' | ||
import { devTools, smallTools } from 'components/cards/tools' | ||
import Suggestion from 'components/layout/web/Suggestion' | ||
|
||
const tools = [...devTools, ...smallTools] | ||
export async function generateStaticParams() { | ||
return [ | ||
...tools.map((tool) => ({ | ||
slug: tool.slug, | ||
})), | ||
...categories.map((category) => ({ slug: category.slug })), | ||
] | ||
} | ||
|
||
type Props = { params: { slug: string } } | ||
|
||
export async function generateMetadata({ params }: Props, parent: ResolvingMetadata): Promise<Metadata> { | ||
const tool = tools.find((tool) => tool.slug === params.slug) | ||
if (tool) { | ||
return { | ||
title: `${tool.title} | Impact CO₂`, | ||
description: tool.description, | ||
} | ||
} | ||
const category = categories.find((category) => category.slug === params.slug) | ||
if (category) { | ||
return { | ||
title: `${category.name} | Impact CO₂`, | ||
description: category.description, | ||
openGraph: { | ||
creators: 'ADEME', | ||
images: `meta/${category.slug}.png`, | ||
}, | ||
} | ||
} | ||
|
||
return parent as Metadata | ||
} | ||
|
||
const OutilPage = async ({ params }: Props) => { | ||
const tool = tools.find((tool) => tool.slug === params.slug) | ||
if (tool) { | ||
return ( | ||
<> | ||
<Outil tool={tool} /> | ||
<Suggestion from={`/outils/${tool.slug}`} fromLabel={tool.title} simulatorName={`de l'outil ${tool.title}`} /> | ||
</> | ||
) | ||
} | ||
|
||
const category = categories.find((category) => category.slug === params.slug) | ||
if (category) { | ||
return ( | ||
<> | ||
<Category category={category} /> | ||
<Suggestion | ||
from={`/outils/${category.slug}`} | ||
fromLabel={category.name} | ||
simulatorName={`de la thématique ${category.name}`} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
return notFound() | ||
} | ||
|
||
export default OutilPage |
This file was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.box { | ||
border-radius: 8px; | ||
cursor: pointer; | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 0.5rem; | ||
justify-content: space-between; | ||
padding: 0.625rem 0.75rem 0.625rem 1rem; | ||
position: relative; | ||
text-align: left; | ||
width: 100%; | ||
border: 1px solid var(--neutral-10); | ||
background-color: var(--neutral-10); | ||
color: var(--neutral-60); | ||
|
||
.copy { | ||
color: var(--primary-50); | ||
} | ||
|
||
&:hover { | ||
background-color: var(--neutral-00); | ||
outline: 1px solid var(--neutral-10); | ||
|
||
.copy { | ||
color: var(--primary-70); | ||
} | ||
} | ||
|
||
&:focus { | ||
outline-offset: 2px; | ||
outline: 3px solid var(--primary-40); | ||
} | ||
|
||
&:focus:not(:focus-visible) { | ||
outline: none; | ||
} | ||
} | ||
|
||
.content { | ||
display: inline-block; | ||
width: fit-content; | ||
word-break: break-word; | ||
} | ||
|
||
.copy { | ||
align-items: center; | ||
display: flex; | ||
flex-grow: 1; | ||
font-size: 0.875rem; | ||
font-weight: 500; | ||
justify-content: flex-end; | ||
line-height: 1.25rem; | ||
right: 1rem; | ||
top: calc(50% - 0.5rem); | ||
|
||
svg { | ||
margin-left: 0.25rem; | ||
} | ||
} | ||
|
||
.copied { | ||
color: var(--success-60) !important; | ||
} | ||
|
||
.information { | ||
align-items: center; | ||
color: var(--neutral-50); | ||
display: flex; | ||
font-size: 0.75rem; | ||
font-weight: 400; | ||
gap: 0.5rem; | ||
line-height: 1rem; | ||
margin-top: 0.5rem; | ||
|
||
svg { | ||
height: 1.5rem; | ||
width: 1.5rem; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,3 +1,5 @@ | ||
'use client' | ||
|
||
import classNames from 'classnames' | ||
import React from 'react' | ||
import twemoji from 'twemoji' | ||
|
Oops, something went wrong.