feat: modules and module-editor pages
This commit is contained in:
38
src/app/modules/components/InnerAttributesTable.tsx
Normal file
38
src/app/modules/components/InnerAttributesTable.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
"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%" } }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default InnerAttributesTable;
|
||||
Reference in New Issue
Block a user