feat: add localized empty text support to CollectionList component

This commit is contained in:
yessenia 2026-03-04 17:44:18 +08:00
parent 61b6b838de
commit 237eead38c
3 changed files with 6 additions and 3 deletions

View File

@ -119,6 +119,7 @@ type CollectionListProps<TItem, TCollection extends BaseCollection> = {
gridClassName?: string
cardContainerClassName?: string
emptyClassName?: string
emptyText?: string
}
function CollectionList<TItem, TCollection extends BaseCollection>({
@ -131,6 +132,7 @@ function CollectionList<TItem, TCollection extends BaseCollection>({
gridClassName = GRID_CLASS,
cardContainerClassName,
emptyClassName,
emptyText,
}: CollectionListProps<TItem, TCollection>) {
const locale = useLocale()
@ -139,7 +141,7 @@ function CollectionList<TItem, TCollection extends BaseCollection>({
})
if (collectionsWithItems.length === 0) {
return <Empty className={emptyClassName} />
return <Empty className={emptyClassName} text={emptyText} />
}
return (

View File

@ -2,6 +2,7 @@
import type { PluginCollection, Template, TemplateCollection } from '../types'
import type { Plugin } from '@/app/components/plugins/types'
import { useTranslation } from '#i18n'
import CardWrapper from './card-wrapper'
import { CAROUSEL_COLLECTION_NAMES } from './collection-constants'
import CollectionList from './collection-list'
@ -29,6 +30,7 @@ type ListWithCollectionProps = PluginsVariant | TemplatesVariant
const ListWithCollection = (props: ListWithCollectionProps) => {
const { variant, cardContainerClassName } = props
const { t } = useTranslation()
if (variant === 'plugins') {
const {
@ -76,6 +78,7 @@ const ListWithCollection = (props: ListWithCollectionProps) => {
renderCard={renderTemplateCard}
carouselCollectionNames={[CAROUSEL_COLLECTION_NAMES.featured]}
cardContainerClassName={cardContainerClassName}
emptyText={t('marketplace.noTemplateFound', { ns: 'plugin' })}
/>
)
}

View File

@ -75,8 +75,6 @@ const TemplateCardComponent = ({
<div className="flex min-w-0 flex-1 flex-col justify-center gap-0.5">
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="system-md-medium truncate text-text-primary after:absolute after:inset-0"
>
{template_name}