import { Localization } from "@Component/Localization/Localization"; import { FontLevel, Theme } from "@Component/Theme/Theme"; import { Icon } from "@fluentui/react"; import { Component, ReactNode } from "react"; import "./LoadFile.scss"; interface ILoadFileState { show: boolean; } class LoadFile extends Component<{}, ILoadFileState> { public state: Readonly = { show: false }; private renderMask() { return
; } private offDragTimer: NodeJS.Timeout | undefined; private handleWindowsDragOnFiles = () => { clearTimeout(this.offDragTimer as number | undefined); this.setState({ show: true }); } private handleWindowsDragOffFiles = () => { clearTimeout(this.offDragTimer as number | undefined); this.offDragTimer = setTimeout(() => { this.setState({ show: false }); }); } public componentDidMount() { window.addEventListener("dragenter", this.handleWindowsDragOnFiles); } public componentWillUnmount() { window.removeEventListener("dragenter", this.handleWindowsDragOnFiles); } public render(): ReactNode { return this.state.show ? this.renderMask() : null; } } export { LoadFile };