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) => {
|
{props.items.map((item, i) => {
|
||||||
const gridColumn = item.featured ? 'span 2' : 'auto'
|
const gridColumn = item.featured ? 'span 2' : 'auto'
|
||||||
const layout: CardLayout = item.featured ? 'featured' : 'simple'
|
const layout: CardLayout = item.featured ? 'featured' : 'simple'
|
||||||
const src = item.coverSrc
|
const src = item.coverSrc ?? process.env.APP_CARD_DEFAULT_IMAGE
|
||||||
const srcSet = imageSrcSet(item.coverSrc, [ImageSize.large, ImageSize.medium, ImageSize.small])
|
const srcSet = imageSrcSet(src, [ImageSize.large, ImageSize.medium, ImageSize.small])
|
||||||
|
|
||||||
const content = !item.featured
|
const content = !item.featured
|
||||||
? (
|
? (
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ export type ResizeOptions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resizeImage(src: string, options: ResizeOptions): string {
|
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`
|
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 = {
|
export type PageCardData = {
|
||||||
url: string
|
url: string
|
||||||
title: string
|
title: string
|
||||||
featured: boolean
|
|
||||||
date: Date
|
date: Date
|
||||||
coverSrc: string
|
featured?: boolean
|
||||||
|
coverSrc?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPage {
|
export interface IPage {
|
||||||
|
|||||||
Reference in new issue
Block a user