import _ from 'lodash';

import ShortViewText from '@/components/ShortViewText';
import { cn } from '@/lib/utils';

import { TableItemProps } from '../TableItem';
import EmptyItem from './EmptyItem';

const StringItem = (props: TableItemProps) => {

  const value = props.value;
  const tokens = props.boardTokens;

  if (!value) return <EmptyItem {...props} />;

  if (tokens) {
    return (
      <ShortViewText
        type="middle"
        className={cn(tokens.valueClass)}
        text={value}
        maxLength={tokens.shortTextMaxLength}
      />
    );
  }

  return <ShortViewText type="middle" text={value} maxLength={30} />

}

export default StringItem;
