fix factory
This commit is contained in:
1 parent
a890b1bb75
commit
a2a0932d33
1 file changed
+3
-18
+3
-18
@@ -1,7 +1,7 @@
|
|||||||
import { getResizedUrl } from "@/lib/image";
|
import { getResizedUrl } from "@/lib/image";
|
||||||
import { IPage, ITag, PageCardDto, Token } from "@/types";
|
import { IPage, ITag, PageCardDto, Token } from "@/types";
|
||||||
import { asItem } from "./lib";
|
import { asItem } from "./lib";
|
||||||
import { StrapiComponentEmbed, StrapiComponent, StrapiHome, StrapiPage, StrapiPageCard, StrapiComponentCardGrid } from "./types";
|
import { StrapiComponentEmbed, StrapiComponent, StrapiHome, StrapiPage, StrapiPageCard } from "./types";
|
||||||
|
|
||||||
export function createPageUrls(pages: StrapiPage[]) {
|
export function createPageUrls(pages: StrapiPage[]) {
|
||||||
return {
|
return {
|
||||||
@@ -160,25 +160,10 @@ export function createCardGrid(card: StrapiPageCard): PageCardDto {
|
|||||||
// alt: '',
|
// alt: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function createHomeCards(data: StrapiHome): PageCardDto[] {
|
export function createHomeCards(data: StrapiHome): PageCardDto[] {
|
||||||
// const cover = item.coverSrc ?? process.env.APP_CARD_DEFAULT_IMAGE
|
// const cover = item.coverSrc ?? process.env.APP_CARD_DEFAULT_IMAGE
|
||||||
|
|
||||||
return data.cards.map(card => {
|
return data.cards.map(createCardGrid)
|
||||||
return {
|
|
||||||
id: card.id,
|
|
||||||
// id: card.page.id,
|
|
||||||
url: card.page.slug,
|
|
||||||
title: card.page.title,
|
|
||||||
featured: isCardFeatured(card),
|
|
||||||
date: card.page.date,
|
|
||||||
cover: {
|
|
||||||
src: card.page.cover.url,
|
|
||||||
width: card.page.cover.width,
|
|
||||||
height: card.page.cover.height,
|
|
||||||
alt: '',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user