42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
"use client";
|
||
|
||
import { FC } from "react";
|
||
import { Center, Text } from "@mantine/core";
|
||
import useAttributesInnerTableColumns from "@/app/modules/hooks/useAttributesInnerTableColumns";
|
||
import BaseTable from "@/components/ui/BaseTable/BaseTable";
|
||
import { ModuleAttributeSchema } from "@/lib/client";
|
||
|
||
type Props = {
|
||
attributes: ModuleAttributeSchema[];
|
||
moduleId: number;
|
||
};
|
||
|
||
const InnerAttributesTable: FC<Props> = ({ attributes, moduleId }) => {
|
||
const innerColumns = useAttributesInnerTableColumns();
|
||
|
||
if (attributes.length === 0) {
|
||
return (
|
||
<Center my={"md"}>
|
||
<Text>В модуле нет атрибутов</Text>
|
||
</Center>
|
||
);
|
||
}
|
||
|
||
return (
|
||
<BaseTable
|
||
key={moduleId}
|
||
withTableBorder
|
||
columns={innerColumns}
|
||
records={attributes}
|
||
verticalSpacing={"md"}
|
||
groups={undefined}
|
||
styles={{
|
||
table: { width: "100%" },
|
||
header: { zIndex: 0 },
|
||
}}
|
||
/>
|
||
);
|
||
};
|
||
|
||
export default InnerAttributesTable;
|