2023-10-06 13:44:06 +11:00
|
|
|
import { Badge, Box, Text, as, toRem } from 'folds';
|
|
|
|
|
import React from 'react';
|
2024-05-31 19:49:46 +05:30
|
|
|
import { mimeTypeToExt } from '../../utils/mimeTypes';
|
2023-10-06 13:44:06 +11:00
|
|
|
|
|
|
|
|
const badgeStyles = { maxWidth: toRem(100) };
|
|
|
|
|
|
|
|
|
|
export type FileHeaderProps = {
|
|
|
|
|
body: string;
|
|
|
|
|
mimeType: string;
|
|
|
|
|
};
|
|
|
|
|
export const FileHeader = as<'div', FileHeaderProps>(({ body, mimeType, ...props }, ref) => (
|
|
|
|
|
<Box alignItems="Center" gap="200" grow="Yes" {...props} ref={ref}>
|
|
|
|
|
<Badge style={badgeStyles} variant="Secondary" radii="Pill">
|
|
|
|
|
<Text size="O400" truncate>
|
|
|
|
|
{mimeTypeToExt(mimeType)}
|
|
|
|
|
</Text>
|
|
|
|
|
</Badge>
|
|
|
|
|
<Text size="T300" truncate>
|
|
|
|
|
{body}
|
|
|
|
|
</Text>
|
|
|
|
|
</Box>
|
|
|
|
|
));
|