import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; import useFlag from '../../../hooks/useFlag'; import buildClassName from '../../../util/buildClassName'; import './DropTarget.scss'; export type OwnProps = { isQuick?: boolean; isGeneric?: boolean; onFileSelect: (e: React.DragEvent) => void; }; const DropTarget: FC = ({ isQuick, isGeneric, onFileSelect }) => { const [isHovered, markHovered, unmarkHovered] = useFlag(); const handleDragLeave = (e: React.DragEvent) => { const { relatedTarget: toTarget } = e; if (toTarget) { e.stopPropagation(); } unmarkHovered(); }; const className = buildClassName( 'DropTarget', isHovered && 'hovered', ); return (
Drop files here to send them
{!isGeneric &&
{isQuick ? 'in a quick way' : 'without compression'}
}
); }; export default memo(DropTarget);