import * as React from 'react';
import { RenderProps, StateProps } from 'src/types/op-table';

export default function State(props: RenderProps) {
  const { value = '', record = {}, options = {} } = props;

  // 兼容之前直接判断 conditionValue 显示红色的逻辑
  const { conditionKey = 'pkStatus', conditionValue = '破损' } =
    options as StateProps;
  if (record[conditionKey] === conditionValue) {
    return <span className='pkStatus'>{value}</span>;
  }
  return <>{value}</>;
}
