forked from tinacms/tina.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚏 Move /whats-new pages to app router (tinacms#2690)
* whats-new pages move to app router * fix names
- Loading branch information
1 parent
9410d5a
commit 68cd312
Showing
7 changed files
with
205 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { whatsNewMDComponents } from 'components/styles/WhatsNewMDComponents'; | ||
import Link from 'next/link'; | ||
import { FaNewspaper } from 'react-icons/fa'; | ||
import { TinaMarkdown } from 'tinacms/dist/rich-text'; | ||
|
||
export const WhatsNewTinaCloudPageLayout = ({ data }) => { | ||
const items = data.WhatsNewTinaCloudConnection.edges.map((edge) => edge.node); | ||
|
||
return ( | ||
<div className="p-6 py-12 lg:py-16 last:pb-20 last:lg:pb-32 max-w-prose mx-auto"> | ||
<h1 className="text-center justify-center font-tuner text-3xl lg:text-4xl lg:leading-tight bg-gradient-to-br from-orange-400 via-orange-600 to-orange-700 group-hover:from-orange-300 group-hover:via-orange-500 group-hover:to-orange-700 bg-clip-text text-transparent"> | ||
What's new with TinaCloud | ||
</h1> | ||
<div className="mt-8"> | ||
{items.length === 0 ? ( | ||
<p className="text-gray-500">No items found</p> | ||
) : ( | ||
items.map((item) => ( | ||
<div | ||
key={item.id} | ||
className="mb-6 p-10 shadow-xl rounded-lg transform transition-transform duration-300 hover:scale-105 bg-gradient-to-br from-white/25 via-white/50 to-white/75" | ||
> | ||
<h2 className="text-2xl bg-gradient-to-br from-blue-700 to-blue-1000 bg-clip-text text-transparent text-blue-700 font-semibold"> | ||
Version {item.versionNumber} | ||
</h2> | ||
<p className="text-sm text-gray-500"> | ||
Released on {new Date(item.dateReleased).toLocaleDateString()} | ||
</p> | ||
<TinaMarkdown | ||
content={item.body} | ||
components={whatsNewMDComponents} | ||
/> | ||
</div> | ||
)) | ||
)} | ||
</div> | ||
<div className="font-tuner text-lg text-center text-blue-700"> | ||
<Link | ||
href="https://us20.campaign-archive.com/home/?u=1fea337bee20e7270d025ea8a&id=c1062536a1" | ||
className="flex items-center justify-center hover:text-blue-800" | ||
> | ||
See Newsletters <FaNewspaper className="ml-2" /> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WhatsNewTinaCloudPageLayout; |
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,50 @@ | ||
import { client } from 'tina/__generated__/client'; | ||
import WhatsNewTinaCloudPageLayout from './WhatsNewTinaCloudPageLayout'; | ||
|
||
export async function generateMetadata() { | ||
const vars = { last: 10, sort: 'dateReleased' }; | ||
const { data } = await fetchTinaCloudData(vars); | ||
const nodesData = data.WhatsNewTinaCloudConnection.edges.map( | ||
(edge) => edge.node | ||
); | ||
const seoData = (nodesData[0] as { seo?: any })?.seo || { | ||
title: "What's New in TinaCloud", | ||
description: | ||
'Stay updated with the latest improvements and features in TinaCloud.', | ||
}; | ||
|
||
return { | ||
title: seoData.title, | ||
description: seoData.description, | ||
openGraph: { | ||
title: seoData.title, | ||
description: seoData.description, | ||
type: 'website', | ||
locale: 'en_CA', | ||
site_name: 'https://tina.io/tinacloud', | ||
images: [ | ||
{ | ||
url: 'https://tina.io/img/tina-og.png', | ||
width: 1200, | ||
height: 628, | ||
alt: 'Tina - The Markdown CMS', | ||
}, | ||
], | ||
}, | ||
}; | ||
} | ||
|
||
export default async function TinaCloudPage() { | ||
const vars = { last: 10, sort: 'dateReleased' }; | ||
const { data, query } = await fetchTinaCloudData(vars); | ||
|
||
return <WhatsNewTinaCloudPageLayout data={data} />; | ||
} | ||
|
||
const fetchTinaCloudData = async (vars = {}) => { | ||
const res = await client.queries.WhatsNewTinaCloudConnection(vars); | ||
return { | ||
data: res.data, | ||
query: res.query, | ||
}; | ||
}; |
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,52 @@ | ||
import { Layout } from 'components/layout'; | ||
import { whatsNewMDComponents } from 'components/styles/WhatsNewMDComponents'; | ||
import Link from 'next/link'; | ||
import { FaGithub, FaNewspaper } from 'react-icons/fa'; | ||
import { TinaMarkdown } from 'tinacms/dist/rich-text'; | ||
|
||
const WhatsNewTinaCMSPageLayout = ({ data }) => { | ||
const items = data.WhatsNewTinaCMSConnection.edges.map((edge) => edge.node); | ||
|
||
return ( | ||
<div className="p-6 py-12 lg:py-16 last:pb-20 last:lg:pb-32 max-w-prose md:mx-auto"> | ||
<h1 className="text-center justify-center font-tuner text-3xl lg:text-4xl lg:leading-tight bg-gradient-to-br from-orange-400 via-orange-600 to-orange-700 group-hover:from-orange-300 group-hover:via-orange-500 group-hover:to-orange-700 bg-clip-text text-transparent"> | ||
What's new with TinaCMS | ||
</h1> | ||
<div className="mt-8"> | ||
{items.map((item) => ( | ||
<div | ||
key={item.id} | ||
className="mb-6 p-10 shadow-xl rounded-lg transform transition-transform duration-300 hover:scale-105 bg-gradient-to-br from-white/25 via-white/50 to-white/75" | ||
> | ||
<h2 className="text-2xl bg-gradient-to-br from-blue-700 to-blue-1000 bg-clip-text text-transparent text-blue-700 font-semibold"> | ||
Version {item.versionNumber} | ||
</h2> | ||
<p className="text-sm text-gray-500"> | ||
Released on {new Date(item.dateReleased).toLocaleDateString()} | ||
</p> | ||
<TinaMarkdown | ||
content={item.body} | ||
components={whatsNewMDComponents} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
<div className="font-tuner text-lg text-center text-blue-700"> | ||
<Link | ||
href="https://github.com/tinacms/tinacms/blob/main/packages/tinacms/CHANGELOG.md" | ||
className="flex items-center justify-center hover:text-blue-800" | ||
> | ||
See more on GitHub <FaGithub className="ml-2" /> | ||
</Link> | ||
<Link | ||
href="https://us20.campaign-archive.com/home/?u=1fea337bee20e7270d025ea8a&id=c1062536a1" | ||
className="flex items-center justify-center hover:text-blue-800" | ||
> | ||
See Newsletters <FaNewspaper className="ml-2" /> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WhatsNewTinaCMSPageLayout; |
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,52 @@ | ||
import { client } from 'tina/__generated__/client'; | ||
import WhatsNewTinaCMSPageLayout from './WhatsNewTinaCMSLayout'; | ||
|
||
export async function generateMetadata() { | ||
const vars = { last: 10, sort: 'dateReleased' }; | ||
const { data } = await fetchWhatsNewData(vars); | ||
const nodesData = data.WhatsNewTinaCMSConnection.edges.map( | ||
(edge: any) => edge.node | ||
); | ||
const whatsNewSEOData = nodesData[0].seo || { | ||
title: "What's New in TinaCMS", | ||
description: 'Discover the latest updates and features in TinaCMS.', | ||
}; | ||
|
||
return { | ||
title: whatsNewSEOData.title, | ||
description: whatsNewSEOData.description, | ||
openGraph: { | ||
title: whatsNewSEOData.title, | ||
description: whatsNewSEOData.description, | ||
type: 'website', | ||
locale: 'en_CA', | ||
site_name: 'https://tina.io/whats-new', | ||
images: [ | ||
{ | ||
url: 'https://tina.io/img/tina-og.png', | ||
width: 1200, | ||
height: 628, | ||
alt: `Tina - The Markdown CMS`, | ||
}, | ||
], | ||
}, | ||
}; | ||
} | ||
|
||
export default async function TinaCMSPage() { | ||
const vars = { last: 10, sort: 'dateReleased' }; | ||
|
||
const { data, query } = await fetchWhatsNewData(vars); | ||
|
||
console.log(data); | ||
// return <div> banana</div> | ||
return <WhatsNewTinaCMSPageLayout data={data} />; | ||
} | ||
|
||
const fetchWhatsNewData = async (vars = {}) => { | ||
const res = await client.queries.WhatsNewTinaCMSConnection(vars); | ||
return { | ||
data: res.data, | ||
query: res.query, | ||
}; | ||
}; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.