import React, { useState } from "react"; import PropTypes from "prop-types"; import Text from "../text"; import Link from "../link"; import globalColors from "../utils/globalColors"; import { StyledTableHeaderCell } from "./StyledTableContainer"; const TableHeaderCell = ({ column, index, onMouseDown, resizable, sortBy, sorted, }) => { const { options, title, enable } = column; const isActive = column.sortBy === sortBy; const onClick = (e) => { column.onClick(column.sortBy, e); }; return (
{column.onClick ? (
{enable ? title : ""}
) : ( {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;