home page strapi integration
This commit is contained in:
1 parent
91982b8c99
commit
87f4f6a1b8
8 files changed
+101
-136
No files matched your search
+11
-7
@@ -4,9 +4,10 @@ import { Meta } from 'src/components/Meta'
|
||||
import { PageGrid } from 'src/components/PageGrid'
|
||||
import { HudozkaTitle } from 'src/components/HudozkaTitle'
|
||||
import { MetaBuilder } from 'src/lib/meta'
|
||||
import { getPagesCardsByTags } from 'src/rest'
|
||||
import { NextPage } from 'next'
|
||||
import { IMeta, PageCardData, PageCardDto } from 'src/types'
|
||||
import { apiGet } from '@/next-lib'
|
||||
import { createHomeCards } from '@/remote/factory'
|
||||
|
||||
type Props = {
|
||||
title: string
|
||||
@@ -16,11 +17,16 @@ type Props = {
|
||||
|
||||
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),
|
||||
coverSrc: item.cover?.src,
|
||||
cover: {
|
||||
src: item.cover.src,
|
||||
width: item.cover.width,
|
||||
height: item.cover.height,
|
||||
}
|
||||
}))
|
||||
|
||||
return (
|
||||
@@ -47,11 +53,9 @@ const Index: NextPage<Props> = props => {
|
||||
}
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
const items = await getPagesCardsByTags([
|
||||
'event',
|
||||
'album',
|
||||
'post',
|
||||
])
|
||||
const url = 'https://hudozka.tmshv.com/home'
|
||||
const items = await apiGet(createHomeCards)(url, [])
|
||||
|
||||
const title = 'Шлиссельбургская ДХШ'
|
||||
const meta = (new MetaBuilder())
|
||||
.setTitle(title)
|
||||
|
||||
Reference in new issue
Block a user