40 lines
849 B
TypeScript
40 lines
849 B
TypeScript
import AdminRow from '../AdminRow/AdminRow';
|
|
import type { CollapseProps } from 'antd';
|
|
import { Collapse } from 'ui/elements';
|
|
|
|
export default function AdminRows({
|
|
index,
|
|
name,
|
|
onClick,
|
|
queries,
|
|
}: {
|
|
readonly index: number;
|
|
readonly name: string;
|
|
readonly onClick: (name: string, key: string) => void;
|
|
readonly queries: string[];
|
|
}) {
|
|
if (queries.length === 0) {
|
|
const items: CollapseProps['items'] = [
|
|
{
|
|
children: null,
|
|
key: index.toString(),
|
|
label: name,
|
|
},
|
|
];
|
|
|
|
return <Collapse items={items} />;
|
|
}
|
|
|
|
const rows: CollapseProps['items'] = [
|
|
{
|
|
children: queries.map((x, ind) => (
|
|
<AdminRow key={x} data={x} index={ind} name={name} onClick={onClick} />
|
|
)),
|
|
key: index.toString(),
|
|
label: name,
|
|
},
|
|
];
|
|
|
|
return <Collapse items={rows} />;
|
|
}
|