ragflow/web/src/components/icon-font.tsx
balibabu 1657755b5d
Feat: Adjust the operation cell of the table on the file management page and dataset page #3221. (#7526)
### What problem does this PR solve?

Feat: Adjust the operation cell of the table on the file management page
and dataset page #3221.
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2025-05-08 15:25:26 +08:00

30 lines
692 B
TypeScript

import { FileIconMap } from '@/constants/file';
import { cn } from '@/lib/utils';
import { getExtension } from '@/utils/document-util';
type IconFontType = {
name: string;
className?: string;
};
export const IconFont = ({ name, className }: IconFontType) => (
<svg className={cn('fill-current size-4', className)}>
<use xlinkHref={`#icon-${name}`} />
</svg>
);
export function FileIcon({
name,
className,
type,
}: IconFontType & { type?: string }) {
const isFolder = type === 'folder';
return (
<span className={cn('size-4', className)}>
<IconFont
name={isFolder ? 'file-sub' : FileIconMap[getExtension(name)]}
></IconFont>
</span>
);
}