use cover instead of preview of coverSrc

This commit is contained in:
tmshv committed 2020-03-11 13:38:50 +03:00
1 parent a4d245007e
commit b7f3bbbcef
9 files changed
+72 -58

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ export const getStaticProps = async (ctx: any) => {
const breadcrumbSize = page?.breadcrumb?.length ?? 0
const breadcrumb = breadcrumbSize < 2 ? null : page.breadcrumb
const meta = (new MetaBuilder())
.setImage(page.preview)
.setImage(page.cover)
.setTitle(page.title)
.setDescription(description)
.build()
+2 -4
View File
@@ -109,15 +109,13 @@ export const getStaticProps = async (ctx: NextPageContext) => {
const data: CardData[] = pages
.filter(Boolean)
.map(x => {
const image = x.preview.artifacts.large
return {
title: x.title,
caption: x.description,
href: x.url,
imageAlt: title,
imageSrc: image.src,
imageSrcSet: imageSrcSet(image.src, [ImageSize.medium, ImageSize.small])
imageSrc: x.cover.src,
imageSrcSet: imageSrcSet(x.cover.src, [ImageSize.medium, ImageSize.small])
}
})
+14 -12
View File
@@ -1,16 +1,15 @@
import React from 'react'
import Head from 'next/head'
import { App } from 'src/components/App'
import Document from 'src/components/Document'
import { File } from 'src/components/File'
import { Share } from 'src/components/Share'
import { meta } from 'src/lib/meta'
import { MetaBuilder } from 'src/lib/meta'
import { Meta } from 'src/components/Meta'
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
import { NextPage } from 'next'
import { IMeta } from 'src/types'
import { IMeta, FileDefinition } from 'src/types'
type Props = {
data: any //(file)
data: FileDefinition
meta: IMeta
}
@@ -26,25 +25,28 @@ const Page: NextPage<Props> = props => {
showAuthor={true}
>
<Head>
<title>{props.data.title}</title>
<title>{props.data.name}</title>
<Meta meta={props.meta} />
</Head>
<Document {...props.data} />
<File {...props.data} />
<Share />
</App>
)
}
export const getStaticProps = async (ctx: any) => {
const id = ctx.params.slug
const data = await requestGet(createApiUrl(`/api/files/${id}`), {})
const slug = ctx.params.slug
const data = await requestGet<FileDefinition>(createApiUrl(`/api/files/${slug}`), null)
const meta = (new MetaBuilder())
.setImage(data.cover)
.setTitle(data.name)
.setDescription(data.name)
.build()
return {
props: {
data,
meta: meta({
// title: file.meta,
})
meta,
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ const Index: NextPage<IProps> = props => {
title: item.title,
featured: item.featured,
date: new Date(item.date),
coverSrc: item.coverSrc,
coverSrc: item.cover?.src,
}))
return (