Skip to content

Commit

Permalink
feat(editor): display size in file summary
Browse files Browse the repository at this point in the history
  • Loading branch information
sabberworm committed Oct 28, 2024
1 parent 0fe14ca commit ecf0c89
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/frontend/sections/output/FileMessageOutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Elm = styled('div')`
border-radius: 12px;
display: grid;
gap: 6px;
grid-template-areas: 'icon name . download' 'icon type . download';
grid-template-areas: 'icon name name download' 'icon type size download';
grid-template-columns: max-content max-content 1fr max-content;
> coral-icon {
grid-area: icon;
Expand All @@ -28,6 +28,9 @@ const Elm = styled('div')`
> .type {
grid-area: type;
}
> .size {
grid-area: size;
}
> a {
grid-area: download;
}
Expand Down Expand Up @@ -71,13 +74,15 @@ function iconFor(mimeType: MimeType): CoralIcon {

export const FileMessageOutput: FC<{ message: FileMessage }> = ({ message }) => {
const icon = iconFor(message.mime);
const blob = message.blob!;

return (
<Elm>
<coral-icon icon={icon} size="L" />
<span className="name">{message.name}</span>
<small className="type">{message.mime}</small>
<a href={URL.createObjectURL(message.blob!)} download={message.name}>
<small className="size">{blob.size} bytes</small>
<a href={URL.createObjectURL(blob)} download={message.name}>
<button type="button" is="coral-button" icon="download">
Download
</button>
Expand Down

0 comments on commit ecf0c89

Please sign in to comment.