diff --git a/packages/core/src/components/collections/entries/EntryListing.tsx b/packages/core/src/components/collections/entries/EntryListing.tsx index 91e91306..e5bc00df 100644 --- a/packages/core/src/components/collections/entries/EntryListing.tsx +++ b/packages/core/src/components/collections/entries/EntryListing.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useMemo } from 'react'; import { Waypoint } from 'react-waypoint'; import { selectFields, selectInferredField } from '@staticcms/core/lib/util/collection.util'; +import { toTitleCaseFromKey } from '@staticcms/core/lib/util/string.util'; import Table from '../../common/table/Table'; import EntryCard from './EntryCard'; @@ -122,18 +123,27 @@ const EntryListing = ({ const summaryFieldHeaders = useMemo(() => { if ('collection' in otherProps) { - return selectFields(otherProps.collection).map(f => f.label ?? f.name); + const collectionFields = selectFields(otherProps.collection).reduce((acc, f) => { + acc[f.name] = f; + return acc; + }, {} as Record); + return summaryFields.map(summaryField => { + const field = collectionFields[summaryField]; + return !field + ? toTitleCaseFromKey(summaryField) + : field.label ?? toTitleCaseFromKey(field.name); + }); } return []; - }, [otherProps]); + }, [otherProps, summaryFields]); if (viewStyle === 'VIEW_STYLE_LIST') { return ( <> {renderedCards} diff --git a/packages/core/src/components/common/table/Table.tsx b/packages/core/src/components/common/table/Table.tsx index a380407f..cb3ad3b6 100644 --- a/packages/core/src/components/common/table/Table.tsx +++ b/packages/core/src/components/common/table/Table.tsx @@ -13,7 +13,7 @@ const TableCell = ({ columns, children }: TableCellProps) => { return (
- + {columns.map((column, index) => ( {column}