54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import {DataGrid, type GridColDef} from '@mui/x-data-grid'
|
|
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
|
import React from 'react'
|
|
|
|
export const CategoryList = () => {
|
|
const {dataGridProps} = useDataGrid({})
|
|
|
|
const columns = React.useMemo<GridColDef[]>(
|
|
() => [
|
|
{
|
|
field: 'id',
|
|
headerName: 'ID',
|
|
type: 'number',
|
|
minWidth: 50,
|
|
display: 'flex',
|
|
align: 'left',
|
|
headerAlign: 'left',
|
|
},
|
|
{
|
|
field: 'title',
|
|
flex: 1,
|
|
headerName: 'Title',
|
|
minWidth: 200,
|
|
display: 'flex',
|
|
},
|
|
{
|
|
field: 'actions',
|
|
headerName: 'Actions',
|
|
align: 'right',
|
|
headerAlign: 'right',
|
|
minWidth: 120,
|
|
sortable: false,
|
|
display: 'flex',
|
|
renderCell: function render({row}) {
|
|
return (
|
|
<>
|
|
<EditButton hideText recordItemId={row.id} />
|
|
<ShowButton hideText recordItemId={row.id} />
|
|
<DeleteButton hideText recordItemId={row.id} />
|
|
</>
|
|
)
|
|
},
|
|
},
|
|
],
|
|
[],
|
|
)
|
|
|
|
return (
|
|
<List>
|
|
<DataGrid {...dataGridProps} columns={columns} />
|
|
</List>
|
|
)
|
|
}
|