mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-28 21:18:57 +00:00
25 lines
688 B
TypeScript
25 lines
688 B
TypeScript
import IconDownload from '@geist-ui/icons/download';
|
|
import IconFileText from '@geist-ui/icons/fileText';
|
|
import IconImage from '@geist-ui/icons/image';
|
|
import IconPaperClip from '@geist-ui/icons/paperclip';
|
|
|
|
import { SimplifiedFileType } from '@/lib/files';
|
|
|
|
/**
|
|
* Render an appropriate icon for a file.
|
|
*/
|
|
export function FileIcon(props: { contentType: SimplifiedFileType | null }) {
|
|
const { contentType } = props;
|
|
|
|
switch (contentType) {
|
|
case 'pdf':
|
|
return <IconFileText />;
|
|
case 'image':
|
|
return <IconImage />;
|
|
case 'archive':
|
|
return <IconPaperClip />;
|
|
default:
|
|
return <IconDownload />;
|
|
}
|
|
}
|