import React from 'react'
import { Tooltip, Text, useColorMode } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'
interface ShortTextProps {
text: string
maxLength?: number
}
export const ShortText = ({ text, maxLength = 30 }: ShortTextProps) => {
const { t } = useTranslation()
const { colorMode } = useColorMode()
if (!text) {
return {t('journal.pl.common.noData')}
}
if (text.length <= maxLength) {
return {text}
}
const shortText = `${text.substring(0, maxLength)}...`
return (
{shortText}
)
}
export default ShortText