-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(broadcasts): news dedicated page (#94)
- Loading branch information
Showing
16 changed files
with
154 additions
and
10 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
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
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
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
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,6 @@ | ||
--- | ||
nav_title: News and events | ||
jsx: true | ||
--- | ||
|
||
# TDP news and events |
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,7 @@ | ||
--- | ||
nav_title: Actualités et evènements | ||
jsx: true | ||
slug: actualites | ||
--- | ||
|
||
# TDP actualités et evènements |
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,17 @@ | ||
import 'server-only' | ||
import Page from '../../discover/news/page' | ||
|
||
export async function generateMetadata() { | ||
return { | ||
title: 'TDP Actualités et événements', | ||
description: 'Dernières actualités sur TDP et liste des événements passés et à venir.', | ||
} | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return [{ | ||
lang: 'fr' | ||
}] | ||
} | ||
|
||
export default Page |
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,14 @@ | ||
import Layout from '../../(pages)/[...slug]/layout.js' | ||
|
||
export default async function newLayout({ | ||
children, | ||
params | ||
}) { | ||
return Layout({ | ||
children, | ||
params: { | ||
...params, | ||
slug: ['decouvrir', 'actualites'] | ||
} | ||
}) | ||
} |
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,14 @@ | ||
import Layout from '../../(pages)/[...slug]/layout.js' | ||
|
||
export default async function newLayout({ | ||
children, | ||
params | ||
}) { | ||
return Layout({ | ||
children, | ||
params: { | ||
...params, | ||
slug: ['discover', 'news'] | ||
} | ||
}) | ||
} |
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,67 @@ | ||
import 'server-only' | ||
import clsx from 'clsx' | ||
import redac from 'redac' | ||
import mdx from 'redac/plugins/mdx' | ||
import yaml from 'redac/plugins/yaml' | ||
|
||
export async function generateMetadata() { | ||
return { | ||
title: 'TDP news and events', | ||
description: 'Latest news on TDP and list of past and future events.', | ||
} | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return [{ | ||
lang: 'en' | ||
}] | ||
} | ||
|
||
export default async function Page({ params }) { | ||
const i18n = await redac([ | ||
{ | ||
module: yaml, | ||
config: './content/i18ns', | ||
}, | ||
]) | ||
.from('i18ns') | ||
.match(params.lang, []) | ||
.map((params) => params.data) | ||
.get() | ||
const broadcasts = await redac([ | ||
{ | ||
module: yaml, | ||
config: './content/broadcasts', | ||
}, | ||
]) | ||
.from('broadcasts') | ||
.map((broadcast) => ({ | ||
...broadcast, | ||
lang: broadcast.lang || 'en', | ||
})) | ||
.filter((broadcast) => broadcast.lang === params.lang) | ||
return ( | ||
<div className="prose dark:prose-invert max-w-none"> | ||
<h1>{i18n.broadcasts.title}</h1> | ||
<ul className="grid gap-3 mb-5 not-prose"> | ||
{broadcasts.reverse().map((broadcast) => ( | ||
<li | ||
key={broadcast.slug.join('/')} | ||
className={clsx( | ||
'py-2 px-3', | ||
'text-white/70 hover:text-white/100 font-extralight', | ||
'rounded border border-white/40 hover:border-white/80' | ||
)} | ||
style={{ | ||
background: | ||
'radial-gradient(50% 50% at 50% 50%, rgba(37, 42, 40, 0.8) 0%, rgba(31, 38, 43, 0.8) 100%)', | ||
}} | ||
> | ||
<p>{broadcast.data.message}</p> | ||
<small>{broadcast.data.when}</small> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
} |
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