fix: collection card image preview

This commit is contained in:
Daniel Lautzenheiser
2023-05-25 07:12:08 -04:00
parent 708efb3d66
commit c8e8a37dea
5 changed files with 52 additions and 11 deletions

View File

@ -11,13 +11,14 @@ const PostPreview = ({ entry, widgetFor }) => {
);
};
const PostPreviewCard = ({ entry, theme, hasLocalBackup, widgetFor }) => {
const PostPreviewCard = ({ entry, theme, hasLocalBackup, collection }) => {
const date = new Date(entry.data.date);
const month = date.getMonth() + 1;
const day = date.getDate();
const image = entry.data.image;
const imageField = useMemo(() => collection.fields.find((f) => f.name === 'image'), []);
const image = useMediaAsset(entry.data.image, collection, imageField, entry);
return h(
'div',