forked from abner/for-legacy-web
Implement new auto-size text area.
Add bars + header + sidebar to channels.
This commit is contained in:
@@ -2,6 +2,7 @@ import { useContext } from 'preact/hooks';
|
||||
import styles from './Attachment.module.scss';
|
||||
import IconButton from '../../../ui/IconButton';
|
||||
import { Attachment } from "revolt.js/dist/api/objects";
|
||||
import { determineFileSize } from '../../../../lib/fileSize';
|
||||
import { AppContext } from '../../../../context/revoltjs/RevoltClient';
|
||||
import { Download, ExternalLink, File, Headphones, Video } from '@styled-icons/feather';
|
||||
|
||||
@@ -9,16 +10,6 @@ interface Props {
|
||||
attachment: Attachment;
|
||||
}
|
||||
|
||||
export function determineFileSize(size: number) {
|
||||
if (size > 1e6) {
|
||||
return `${(size / 1e6).toFixed(2)} MB`;
|
||||
} else if (size > 1e3) {
|
||||
return `${(size / 1e3).toFixed(2)} KB`;
|
||||
}
|
||||
|
||||
return `${size} B`;
|
||||
}
|
||||
|
||||
export default function AttachmentActions({ attachment }: Props) {
|
||||
const client = useContext(AppContext);
|
||||
const { filename, metadata, size } = attachment;
|
||||
|
||||
Reference in New Issue
Block a user