/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2022. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
import Box from "@mui/material/Box";
import Icon from "@mui/material/Icon";
import {Theme} from "@mui/material/styles";
import {ReactNode} from "react";
import colors from "qqq/assets/theme/base/colors";
import {useMaterialUIController} from "qqq/context";
// Declaring props types for DataTableHeadCell
interface Props
{
width?: string | number;
children: ReactNode;
sorted?: false | "none" | "asce" | "desc";
align?: "left" | "right" | "center";
}
function DataTableHeadCell({width, children, sorted, align, ...rest}: Props): JSX.Element
{
const [controller] = useMaterialUIController();
const {darkMode} = controller;
return (
({
borderBottom: `${borderWidth[1]} solid ${colors.grayLines.main}`,
"&:nth-child(1)": {
paddingLeft: "1rem"
},
"&:last-child": {
paddingRight: "1rem"
},
})}
>
({
position: "relative",
color: colors.grey[700],
textAlign: align,
"@media (min-width: 1440px)": {
fontSize: "1rem"
},
"@media (max-width: 1440px)": {
fontSize: "0.875rem"
},
fontWeight: 600,
cursor: sorted && "pointer",
userSelect: sorted && "none",
})}
>
{children}
{sorted && (
({
fontSize: size.lg,
})}
>
arrow_drop_up
arrow_drop_down
)}
);
}
// Declaring default props for DataTableHeadCell
DataTableHeadCell.defaultProps = {
width: "auto",
sorted: "none",
align: "left",
};
export default DataTableHeadCell;