/*
 * @Author: 赵伟
 * @Date: 2025-03-20 14:33:01
 * @Description: 通用的 Table 状态单元格
 */

export type StatusInfo = {
  value: number | string;
  label: string;
  color?: string;
};

function statusTableCell(infos: StatusInfo[]) {
  return function (status?: string | number | null) {
    const info = infos.find((item) => item.value === status);
    if (status === null || status === undefined || !info) {
      return <span>--</span>;
    }
    return <span style={{ color: info.color }}>{info.label}</span>;
  };
}

export default statusTableCell;
