Feature/user management
This commit is contained in:
37
src/core/components/DataTable/hide/HideButton.jsx
Normal file
37
src/core/components/DataTable/hide/HideButton.jsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
import ViewColumnIcon from "@mui/icons-material/ViewColumn";
|
||||
import { IconButton, Tooltip, Badge } from "@mui/material";
|
||||
import useDataTable from "@/lib/hooks/useDataTable";
|
||||
import { flattenObjectOfObjects } from "@/core/utils/flattenObjectOfObjects";
|
||||
|
||||
function HideButton({ drawerState, setDrawerState }) {
|
||||
const { hideData } = useDataTable();
|
||||
const flattenHideData = flattenObjectOfObjects(hideData);
|
||||
const falseCount = Object.values(flattenHideData).filter(
|
||||
(value) => value === false,
|
||||
).length;
|
||||
|
||||
return (
|
||||
<Tooltip title="نمایش/مخفی کردن ستون ها">
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setDrawerState(!drawerState);
|
||||
}}
|
||||
aria-label="hide table column"
|
||||
>
|
||||
<Badge
|
||||
badgeContent={falseCount}
|
||||
color="primary"
|
||||
anchorOrigin={{
|
||||
vertical: "top",
|
||||
horizontal: "left",
|
||||
}}
|
||||
>
|
||||
<ViewColumnIcon />
|
||||
</Badge>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
export default HideButton;
|
||||
Reference in New Issue
Block a user