mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { ICellRendererParams } from '@ag-grid-community/core';
|
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
|
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
|
|
import { useMemo } from 'react';
|
|
import { Text } from '/@/renderer/components/text';
|
|
import { replaceURLWithHTMLLinks } from '/@/renderer/utils/linkify';
|
|
|
|
export const NoteCell = ({ value }: ICellRendererParams) => {
|
|
const formattedValue = useMemo(() => {
|
|
if (!value) {
|
|
return '';
|
|
}
|
|
|
|
return replaceURLWithHTMLLinks(value);
|
|
}, [value]);
|
|
|
|
if (value === undefined) {
|
|
return (
|
|
<CellContainer $position="left">
|
|
<Skeleton
|
|
height="1rem"
|
|
width="80%"
|
|
/>
|
|
</CellContainer>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<CellContainer $position="left">
|
|
<Text
|
|
$secondary
|
|
overflow="hidden"
|
|
>
|
|
{formattedValue}
|
|
</Text>
|
|
</CellContainer>
|
|
);
|
|
};
|