mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 07:28:43 -04:00
* locations onboarding flow * optional * Backend for default location on library creation * Rust fmt * Enhancing error handling and introducing more resilience * Removing .spacedrive metadata on library deletion * Rust fmt again * default to videos --------- Co-authored-by: Ericson Fogo Soares <ericson.ds999@gmail.com>
22 lines
530 B
TypeScript
22 lines
530 B
TypeScript
import clsx from 'clsx';
|
|
import { PropsWithChildren, useRef } from 'react';
|
|
import { Tooltip } from '@sd/ui';
|
|
import { useIsTextTruncated } from '~/hooks';
|
|
|
|
export const TruncatedText = ({
|
|
children,
|
|
className
|
|
}: PropsWithChildren<{ className?: string }>) => {
|
|
const ref = useRef<HTMLDivElement>(null);
|
|
|
|
const isTruncated = useIsTextTruncated(ref);
|
|
|
|
return (
|
|
<Tooltip label={isTruncated ? children : undefined} asChild>
|
|
<div ref={ref} className={clsx('truncate', className)}>
|
|
{children}
|
|
</div>
|
|
</Tooltip>
|
|
);
|
|
};
|