Using pluralize for table title
Signed-off-by: Jordan Snow <jordans@spotify.com>
This commit is contained in:
@@ -43,6 +43,7 @@ import { capitalize } from 'lodash';
|
||||
import React, { ReactNode, useMemo } from 'react';
|
||||
import { columnFactories } from './columns';
|
||||
import { CatalogTableRow } from './types';
|
||||
import pluralize from 'pluralize';
|
||||
|
||||
/**
|
||||
* Props for {@link CatalogTable}.
|
||||
@@ -228,7 +229,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
const showPagination = rows.length > 20;
|
||||
const currentKind = filters.kind?.value || '';
|
||||
const currentType = filters.type?.value || '';
|
||||
const titleDisplay = [titlePreamble, currentType, currentKind]
|
||||
const titleDisplay = [titlePreamble, currentType, pluralize(currentKind)]
|
||||
.filter(s => s)
|
||||
.join(' ');
|
||||
|
||||
@@ -246,7 +247,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
pageSizeOptions: [20, 50, 100],
|
||||
...tableOptions,
|
||||
}}
|
||||
title={`${titleDisplay}${currentKind ? 's' : ''} (${entities.length})`}
|
||||
title={`${titleDisplay} (${entities.length})`}
|
||||
data={rows}
|
||||
actions={actions || defaultActions}
|
||||
subtitle={subtitle}
|
||||
|
||||
Reference in New Issue
Block a user