can now pass the function that gives subtitle as well

This commit is contained in:
Carter 2025-02-26 11:10:26 -06:00
parent d66dc68495
commit 3d8cfc5125
2 changed files with 4 additions and 3 deletions

View file

@ -71,7 +71,7 @@ interface Props<T> {
rows: T[],
columns?: Column<T>[] | (() => Column<T>[]),
title?: string | JSX.Element;
subtitle?: string | JSX.Element;
subtitle?: string | JSX.Element | (() => string | JSX.Element);
total: number,
pageSize: number,
page: number,
@ -98,7 +98,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
setPage,
handleRowsPerPageChange,
title,
subtitle,
// subtitle,
renderGutter,
setSearchText,
isLoading,
@ -113,6 +113,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
} = props
const classes = useStyles();
const columns = typeof(props.columns) === "function" ? props.columns() : props.columns
const subtitle = typeof(props.subtitle) === "function" ? props.subtitle() : props.subtitle
const isMobile = useMobile()

View file

@ -452,7 +452,7 @@ export default function Devices() {
<DevicesSummary setSearch={setSearch} />
<ResponsiveTable<Device>
title={<SmartBreadcrumb prependPaths={getGroup() && ["groups", getGroup().id().toString()]} groupName={getGroup() && getGroup().name()} paddingBottom={1}/>}
subtitle={subtitle()}
subtitle={subtitle}
rows={devices}
renderGutter={ isMobile ? gutter : undefined }
columns={columns}