strapi card grid support

This commit is contained in:
tmshv committed 2021-02-17 14:10:49 +03:00
1 parent 10c27f0ad5
commit 88bb059094
6 files changed
+81 -38

No files matched your search

+9
View File
@@ -15,6 +15,7 @@ import { Html } from 'src/components/Html'
import { Youtube } from '@/components/Youtube'
import { createPage, createPageUrls } from '@/remote/factory'
import { paramsToSlug } from '@/remote/lib'
import { PageGrid } from '@/components/PageGrid'
async function getUrls() {
let urls = []
@@ -147,6 +148,14 @@ const Index: NextPage<Props> = props => (
<File key={i} {...x.data} />
)
case 'grid':
return (
<PageGrid
key={i}
items={x.data.items}
/>
)
default:
return (
<pre key={i}>
+19 -34
View File
@@ -15,42 +15,27 @@ type Props = {
items: PageCardDto[]
}
const Index: NextPage<Props> = props => {
const items = props.items.map<PageCardData>(item => ({
id: item.id,
url: item.url,
title: item.title,
featured: item.featured,
date: new Date(item.date),
cover: {
src: item.cover.src,
width: item.cover.width,
height: item.cover.height,
}
}))
const Index: NextPage<Props> = props => (
<App
showAuthor={true}
wide={true}
>
<Head>
<title>{props.title}</title>
<Meta meta={props.meta} />
</Head>
return (
<App
showAuthor={true}
wide={true}
>
<Head>
<title>{props.title}</title>
<Meta meta={props.meta} />
</Head>
<HudozkaTitle
style={{
marginBottom: 'var(--size-l)'
}}
/>
<HudozkaTitle
style={{
marginBottom: 'var(--size-l)'
}}
/>
<PageGrid
items={items}
/>
</App>
)
}
<PageGrid
items={props.items}
/>
</App>
)
export const getStaticProps = async () => {
const url = 'https://hudozka.tmshv.com/home'