mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
24 lines
482 B
TypeScript
24 lines
482 B
TypeScript
import { Tooltip } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import shortenString from 'lib/shortenString';
|
|
|
|
interface Props {
|
|
hash: string;
|
|
isTooltipDisabled?: boolean;
|
|
}
|
|
|
|
const HashStringShorten = ({ hash, isTooltipDisabled }: Props) => {
|
|
if (hash.length <= 8) {
|
|
return <span>{ hash }</span>;
|
|
}
|
|
|
|
return (
|
|
<Tooltip label={ hash } isDisabled={ isTooltipDisabled }>
|
|
{ shortenString(hash) }
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export default HashStringShorten;
|