import * as React from 'react'

interface TruncateProps {
  length: number
  children: string
}

export const Truncate = ({ length, children }: TruncateProps) =>
  children.length > length - 1
  ? (
    <span title={children}>
      {children.slice(0, length - 1)}&hellip;
    </span>
  )
  : (
    <>
      {children}
    </>
  )
