mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* base implementation of entity * refactor other components to make use of BlockEntity * tests * migrate entities w/o icon + L2 blocks * base implementation of tx entity * delet TransactionSnippet * remove type="transaction" from AddressLink * tests for TxEntity * make EntityBase components * common styles for icon color and spacing to text * update icon color in tests * update icons to slime format * Address entity
26 lines
619 B
TypeScript
26 lines
619 B
TypeScript
import { Tooltip, chakra } from '@chakra-ui/react';
|
|
import type { As } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import shortenString from 'lib/shortenString';
|
|
|
|
interface Props {
|
|
hash: string;
|
|
isTooltipDisabled?: boolean;
|
|
as?: As;
|
|
}
|
|
|
|
const HashStringShorten = ({ hash, isTooltipDisabled, as = 'span' }: Props) => {
|
|
if (hash.length <= 8) {
|
|
return <chakra.span as={ as }>{ hash }</chakra.span>;
|
|
}
|
|
|
|
return (
|
|
<Tooltip label={ hash } isDisabled={ isTooltipDisabled }>
|
|
<chakra.span as={ as }>{ shortenString(hash) }</chakra.span>
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export default HashStringShorten;
|