fix: do not manipulate list labels (#244)

This commit is contained in:
Daniel Lautzenheiser 2022-12-15 15:55:48 -05:00 committed by GitHub
parent d3780695d1
commit 3e4ed60c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,7 +289,7 @@ const ListControl: FC<WidgetControlProps<ObjectValue[], ListField>> = ({
const label = field.label ?? field.name; const label = field.label ?? field.name;
const labelSingular = field.label_singular ? field.label_singular : field.label ?? field.name; const labelSingular = field.label_singular ? field.label_singular : field.label ?? field.name;
const listLabel = internalValue.length === 1 ? labelSingular.toLowerCase() : label.toLowerCase(); const listLabel = internalValue.length === 1 ? labelSingular : label;
return ( return (
<StyledListWrapper key="list-widget"> <StyledListWrapper key="list-widget">
@ -301,7 +301,7 @@ const ListControl: FC<WidgetControlProps<ObjectValue[], ListField>> = ({
types={field[TYPES_KEY] ?? []} types={field[TYPES_KEY] ?? []}
onAddType={type => handleAddType(type, resolveFieldKeyType(field))} onAddType={type => handleAddType(type, resolveFieldKeyType(field))}
heading={`${internalValue.length} ${listLabel}`} heading={`${internalValue.length} ${listLabel}`}
label={labelSingular.toLowerCase()} label={labelSingular}
onCollapseToggle={handleCollapseAllToggle} onCollapseToggle={handleCollapseAllToggle}
collapsed={collapsed} collapsed={collapsed}
hasError={hasErrors} hasError={hasErrors}