import React from 'react';

import {
  List,
  HtmlText
} from '@alicloud/demo-rc-elements';

import {
  IIssue
} from '../../../types';

interface IProps {
  o: IIssue;
}

export default function CellError({
  o: {
    error
  }
}: IProps): JSX.Element | null {
  if (!error?.length) {
    return null;
  }
  
  const errors = typeof error === 'string' ? [error] : error;
  
  return <List>{errors.map(v => <HtmlText key={v} text={v} />)}</List>;
}
