import React from "react"; import PropTypes from "prop-types"; import Text from "../text"; import IconButton from "../icon-button"; import globalColors from "../utils/globalColors"; import { StyledTableHeaderCell } from "./StyledTableContainer"; const TableHeaderCell = ({ column, index, onMouseDown, resizable, sortBy, sorted, }) => { const { title, enable, active, minWidth } = column; const isActive = column.sortBy === sortBy || active; const onClick = (e) => { column.onClick && column.onClick(column.sortBy, e); }; const onIconClick = (e) => { column.onIconClick(); e.stopPropagation(); }; return (
{enable ? title : ""}
{resizable && (
)}
); }; TableHeaderCell.propTypes = { column: PropTypes.object, index: PropTypes.number, onMouseDown: PropTypes.func, resizable: PropTypes.bool, sorted: PropTypes.bool, sortBy: PropTypes.string, }; export default TableHeaderCell;