Files
lettersoup-online/002_source/cms/src/components/dashboard/file-storage/item-icon.tsx
louiscklaw 6c931c1fe8 build ok,
2025-04-14 09:26:24 +08:00

33 lines
801 B
TypeScript

import * as React from 'react';
import Box from '@mui/material/Box';
import { FileIcon } from '@/components/core/file-icon';
import type { ItemType } from './types';
export interface ItemIconProps {
extension?: string;
type: ItemType;
}
export function ItemIcon({ type, extension }: ItemIconProps): React.JSX.Element {
return type === 'folder' ? <FolderIcon /> : <FileIcon extension={extension} />;
}
function FolderIcon(): React.JSX.Element {
return (
<Box
sx={{
alignItems: 'center',
display: 'inline-flex',
flex: '0 0 auto',
justifyContent: 'center',
width: '48px',
height: '48px',
}}
>
<Box alt="Folder" component="img" src="/assets/icon-folder.svg" sx={{ height: '100%', width: 'auto' }} />
</Box>
);
}