mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
35 lines
1009 B
TypeScript
35 lines
1009 B
TypeScript
import { chakra } from '@chakra-ui/react';
|
|
import type { Placement } from '@floating-ui/dom';
|
|
import React from 'react';
|
|
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import { TruncatedTextTooltip } from 'toolkit/components/truncation/TruncatedTextTooltip';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
isLoading?: boolean;
|
|
value: string;
|
|
tooltipPlacement?: Placement;
|
|
tooltipInteractive?: boolean;
|
|
}
|
|
|
|
const TruncatedValue = ({ className, isLoading, value, tooltipPlacement, tooltipInteractive }: Props) => {
|
|
return (
|
|
<TruncatedTextTooltip label={ value } placement={ tooltipPlacement } interactive={ tooltipInteractive }>
|
|
<Skeleton
|
|
className={ className }
|
|
loading={ isLoading }
|
|
display="inline-block"
|
|
whiteSpace="nowrap"
|
|
overflow="hidden"
|
|
textOverflow="ellipsis"
|
|
height="fit-content"
|
|
>
|
|
<span>{ value }</span>
|
|
</Skeleton>
|
|
</TruncatedTextTooltip>
|
|
);
|
|
};
|
|
|
|
export default React.memo(chakra(TruncatedValue));
|