init /city route

This commit is contained in:
maxim
2025-01-27 00:14:57 +03:00
parent eb6490e41d
commit 6d4df1458b
5 changed files with 184 additions and 1 deletions

59
src/pages/city/list.tsx Normal file
View File

@ -0,0 +1,59 @@
import {DataGrid, type GridColDef} from '@mui/x-data-grid'
import {DeleteButton, EditButton, List, useDataGrid} from '@refinedev/mui'
import React from 'react'
export const CityList = () => {
const {dataGridProps} = useDataGrid({})
const columns = React.useMemo<GridColDef[]>(
() => [
{
field: 'id',
headerName: 'ID',
type: 'number',
minWidth: 50,
align: 'left',
headerAlign: 'left',
},
{
field: 'country_code',
headerName: 'Country Code',
type: 'string',
minWidth: 150,
align: 'left',
headerAlign: 'left',
},
{
field: 'name',
headerName: 'City Name',
type: 'string',
minWidth: 150,
flex: 1,
},
{
field: 'actions',
headerName: 'Actions',
align: 'right',
headerAlign: 'center',
minWidth: 120,
sortable: false,
display: 'flex',
renderCell: function render({row}) {
return (
<>
<EditButton hideText recordItemId={row.id} />
<DeleteButton hideText recordItemId={row.id} />
</>
)
},
},
],
[],
)
return (
<List>
<DataGrid {...dataGridProps} columns={columns} />
</List>
)
}