Skip to content

Commit 192687b

Browse files
committed
fix(website): fix website Showcase image bug (#12423)
1 parent 3705528 commit 192687b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎website/src/data/users.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import {translate} from '@docusaurus/Translate';
99
import {sortBy} from '@site/src/utils/jsUtils';
10+
import type {Props as IdealImageProps} from '@theme/IdealImage';
1011

1112
/*
1213
* ADD YOUR SITE TO THE DOCUSAURUS SHOWCASE
@@ -2386,7 +2387,7 @@ const Users: User[] = [
23862387
export type User = {
23872388
title: string;
23882389
description: string;
2389-
preview: string | null; // null = use our serverless screenshot service
2390+
preview: IdealImageProps['img'] | string | null; // null = use our serverless screenshot service
23902391
website: string;
23912392
source: string | null;
23922393
tags: TagType[];

‎website/src/pages/showcase/_components/ShowcaseCard/index.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import React from 'react';
99
import clsx from 'clsx';
1010
import Link from '@docusaurus/Link';
1111
import Translate from '@docusaurus/Translate';
12+
import Image from '@theme/IdealImage';
1213
import {Tags, TagList, type TagType, type User} from '@site/src/data/users';
1314
import {sortBy} from '@site/src/utils/jsUtils';
1415
import Heading from '@theme/Heading';
16+
import type {Props as IdealImageProps} from '@theme/IdealImage';
1517
import FavoriteIcon from '../FavoriteIcon';
1618
import styles from './styles.module.css';
1719

@@ -49,7 +51,7 @@ function ShowcaseCardTag({tags}: {tags: TagType[]}) {
4951
);
5052
}
5153

52-
function getCardImage(user: User): string {
54+
function getCardImage(user: User): IdealImageProps['img'] {
5355
return (
5456
user.preview ??
5557
// TODO make it configurable
@@ -64,7 +66,7 @@ function ShowcaseCard({user}: {user: User}) {
6466
return (
6567
<li key={user.title} className="card shadow--md">
6668
<div className={clsx('card__image', styles.showcaseCardImage)}>
67-
<img src={image} alt={user.title} loading="lazy" />
69+
<Image img={image} alt={user.title} loading="lazy" />
6870
</div>
6971
<div className="card__body">
7072
<div className={clsx(styles.showcaseCardHeader)}>

0 commit comments

Comments
 (0)