diff --git a/src/admin/components/elements/ThumbnailCard/index.tsx b/src/admin/components/elements/ThumbnailCard/index.tsx index 92e28769a9..a15ceb3465 100644 --- a/src/admin/components/elements/ThumbnailCard/index.tsx +++ b/src/admin/components/elements/ThumbnailCard/index.tsx @@ -1,4 +1,4 @@ -import React, { Fragment } from 'react'; +import React from 'react'; import { useTranslation } from 'react-i18next'; import { Props } from './types'; import Thumbnail from '../Thumbnail'; @@ -13,6 +13,11 @@ export const ThumbnailCard: React.FC = (props) => { onClick, doc, collection, + collection: { + admin: { + useAsTitle, + }, + }, thumbnail, label, alignLabel, @@ -28,6 +33,8 @@ export const ThumbnailCard: React.FC = (props) => { alignLabel && `${baseClass}--align-label-${alignLabel}`, ].filter(Boolean).join(' '); + const title: any = doc?.[useAsTitle] || doc?.filename || `[${t('untitled')}]`; + return (
= (props) => { )}
- {label && label} - {!label && doc && ( - - {typeof doc?.filename === 'string' ? doc?.filename : `[${t('untitled')}]`} - - )} + {label || title}
);