page grid image fixes
This commit is contained in:
1 parent
e800de1f92
commit
6e110e3dd7
3 files changed
+8
-4
No files matched your search
@@ -20,8 +20,8 @@ export const PageGrid: React.FC<PageGridProps> = props => {
|
||||
{props.items.map((item, i) => {
|
||||
const gridColumn = item.featured ? 'span 2' : 'auto'
|
||||
const layout: CardLayout = item.featured ? 'featured' : 'simple'
|
||||
const src = item.coverSrc
|
||||
const srcSet = imageSrcSet(item.coverSrc, [ImageSize.large, ImageSize.medium, ImageSize.small])
|
||||
const src = item.coverSrc ?? process.env.APP_CARD_DEFAULT_IMAGE
|
||||
const srcSet = imageSrcSet(src, [ImageSize.large, ImageSize.medium, ImageSize.small])
|
||||
|
||||
const content = !item.featured
|
||||
? (
|
||||
|
||||
@@ -6,6 +6,10 @@ export type ResizeOptions = {
|
||||
}
|
||||
|
||||
export function resizeImage(src: string, options: ResizeOptions): string {
|
||||
if (!src || src === '') {
|
||||
return null
|
||||
}
|
||||
|
||||
return `https://images.weserv.nl/?url=${src}&w=${options.width}&h=${options.height}&n=-1`
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@ export interface IBreadcumbsPart {
|
||||
export type PageCardData = {
|
||||
url: string
|
||||
title: string
|
||||
featured: boolean
|
||||
date: Date
|
||||
coverSrc: string
|
||||
featured?: boolean
|
||||
coverSrc?: string
|
||||
}
|
||||
|
||||
export interface IPage {
|
||||
|
||||
Reference in new issue
Block a user