Skip to content

Commit

Permalink
soriting ok
Browse files Browse the repository at this point in the history
  • Loading branch information
aetchego committed Jan 9, 2025
1 parent 2aac016 commit 8f11b47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/components/ui/Table/TableHead.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Column } from 'types/table'
import { SxProps, TableCell, TableHead as TableHeadMui, TableRow, TableSortLabel, Theme } from '@mui/material'
import { Direction, OrderBy } from 'types/searchCriterias'
import { Direction, Order, OrderBy } from 'types/searchCriterias'

type RowProps = {
columns: Column[]
Expand All @@ -11,12 +11,13 @@ type RowProps = {
}

const TableHead = ({ columns, orderBy, sx, onSort }: RowProps) => {
/*const createSortHandler = (property: Order) => () => {
setOrder({
const handleChangeSort = (property: Order) => {
onSort({
orderBy: property,
orderDirection: order?.orderDirection === Direction.ASC ? Direction.DESC : Direction.ASC
orderDirection: orderBy?.orderDirection === Direction.ASC ? Direction.DESC : Direction.ASC
})
}*/
}

return (
<TableHeadMui>
<TableRow sx={{ ...sx }}>
Expand All @@ -25,7 +26,6 @@ const TableHead = ({ columns, orderBy, sx, onSort }: RowProps) => {
sx={{ fontSize: 11, fontWeight: 600 }}
size="small"
key={col.label}
// sortDirection={order?.orderBy === col.code ? order?.orderDirection : false}
align="left"
// className={classes.tableHeadCell}
>
Expand All @@ -34,7 +34,7 @@ const TableHead = ({ columns, orderBy, sx, onSort }: RowProps) => {
<TableSortLabel
active={orderBy.orderBy === col.code}
direction={orderBy.orderBy === col.code ? orderBy?.orderDirection : Direction.ASC}
onClick={() => onSort({ orderBy: col.code, orderDirection: Direction.ASC })}
onClick={() => handleChangeSort(col.code)}
/>
)}
</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/Table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Table as TableType } from 'types/table'
import { Table as TableMui, Grid, Paper, TableBody, TableContainer, TableSortLabel, Typography } from '@mui/material'
import { Table as TableMui, Paper, TableBody, TableContainer } from '@mui/material'
import TableRow from './TableRow'
import TableHead from './TableHead'
import { OrderBy } from 'types/searchCriterias'
Expand Down

0 comments on commit 8f11b47

Please sign in to comment.