Skip to content

Commit

Permalink
feat: add styles for PerformersSection component
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Amrutiya <[email protected]>
  • Loading branch information
amitamrutiya committed Nov 18, 2024
1 parent 4fef955 commit 411a49f
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions src/custom/ResponsiveDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,42 +310,39 @@ const ResponsiveDataTable = ({
return new Intl.DateTimeFormat('en-US', dateOptions).format(date);
};

const updatedOptions = React.useMemo(
() => ({
...options,
print: false,
download: false,
search: false,
filter: false,
viewColumns: false,
rowsPerPageOptions: rowsPerPageOptions,
onViewColumnsChange: (column: string, action: string) => {
switch (action) {
case 'add': {
const colToAdd = columns.find((obj) => obj.name === column);
if (colToAdd) {
if (colToAdd.options) {
colToAdd.options.display = true;
updateCols && updateCols([...columns]);
}
const updatedOptions = {
...options,
print: false,
download: false,
search: false,
filter: false,
viewColumns: false,
rowsPerPageOptions: rowsPerPageOptions,
onViewColumnsChange: (column: string, action: string) => {
switch (action) {
case 'add': {
const colToAdd = columns.find((obj) => obj.name === column);
if (colToAdd) {
if (colToAdd.options) {
colToAdd.options.display = true;
updateCols && updateCols([...columns]);
}
break;
}
case 'remove': {
const colToRemove = columns.find((obj) => obj.name === column);
if (colToRemove) {
if (colToRemove.options) {
colToRemove.options.display = false;
updateCols && updateCols([...columns]);
}
break;
}
case 'remove': {
const colToRemove = columns.find((obj) => obj.name === column);
if (colToRemove) {
if (colToRemove.options) {
colToRemove.options.display = false;
updateCols && updateCols([...columns]);
}
break;
}
break;
}
}
}),
[options, rowsPerPageOptions, columns, updateCols]
);
}
};

const updateColumnsEffect = useCallback(() => {
columns?.forEach((col) => {
Expand Down Expand Up @@ -388,7 +385,8 @@ const ResponsiveDataTable = ({
}
});
updateCols && updateCols([...columns]);
}, [columnVisibility, updateCols, columns]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [columnVisibility, updateCols]);

React.useEffect(() => {
updateColumnsEffect();
Expand Down

0 comments on commit 411a49f

Please sign in to comment.