import { Badge, Box, Icon, Icons, ProgressBar, Text, percent } from 'folds'; import React, { ReactNode, forwardRef } from 'react'; import * as css from './UploadCard.css'; import { bytesToSize } from '../../utils/common'; type UploadCardProps = { before?: ReactNode; children: ReactNode; after?: ReactNode; bottom?: ReactNode; }; export const UploadCard = forwardRef( ({ before, after, children, bottom, radii }, ref) => ( {before} {children} {after} {bottom} ) ); type UploadCardProgressProps = { sentBytes: number; totalBytes: number; }; export function UploadCardProgress({ sentBytes, totalBytes }: UploadCardProgressProps) { return ( {`${Math.round(percent(0, totalBytes, sentBytes))}%`} {bytesToSize(sentBytes)} / {bytesToSize(totalBytes)} ); } type UploadCardErrorProps = { children: ReactNode; }; export function UploadCardError({ children }: UploadCardErrorProps) { return ( {children} ); }