diff --git a/app/components/DropToImport.js b/app/components/DropToImport.js index 162fa0a6..5c2859d6 100644 --- a/app/components/DropToImport.js +++ b/app/components/DropToImport.js @@ -5,7 +5,7 @@ import { observer, inject } from "mobx-react"; import * as React from "react"; import Dropzone from "react-dropzone"; import { withRouter, type RouterHistory, type Match } from "react-router-dom"; -import { createGlobalStyle } from "styled-components"; +import styled from "styled-components"; import DocumentsStore from "stores/DocumentsStore"; import UiStore from "stores/UiStore"; import LoadingIndicator from "components/LoadingIndicator"; @@ -17,8 +17,6 @@ type Props = { children: React.Node, collectionId: string, documentId?: string, - activeClassName?: string, - rejectClassName?: string, ui: UiStore, documents: DocumentsStore, disabled: boolean, @@ -28,18 +26,6 @@ type Props = { staticContext: Object, }; -export const GlobalStyles = createGlobalStyle` - .activeDropZone { - border-radius: 4px; - background: ${(props) => props.theme.slateDark}; - svg { fill: ${(props) => props.theme.white}; } - } - - .activeDropZone a { - color: ${(props) => props.theme.white} !important; - } -`; - @observer class DropToImport extends React.Component { @observable isImporting: boolean = false; @@ -82,18 +68,7 @@ class DropToImport extends React.Component { }; render() { - const { - documentId, - collectionId, - documents, - disabled, - location, - match, - history, - staticContext, - ui, - ...rest - } = this.props; + const { documents } = this.props; if (this.props.disabled) return this.props.children; @@ -102,16 +77,38 @@ class DropToImport extends React.Component { accept={documents.importFileTypes.join(", ")} onDropAccepted={this.onDropAccepted} style={EMPTY_OBJECT} - disableClick - disablePreview + noClick multiple - {...rest} > - {this.isImporting && } - {this.props.children} + {({ + getRootProps, + getInputProps, + isDragActive, + isDragAccept, + isDragReject, + }) => ( + + + {this.isImporting && } + {this.props.children} + + )} ); } } +const DropzoneContainer = styled("div")` + border-radius: 4px; + background: ${({ isDragActive, theme }) => + isDragActive && theme.slateDark} !important; + a { + color: ${({ isDragActive, theme }) => + isDragActive && theme.white} !important; + } + svg { + fill: ${({ isDragActive, theme }) => isDragActive && theme.white}; + } +`; + export default inject("documents", "ui")(withRouter(DropToImport)); diff --git a/app/components/Layout.js b/app/components/Layout.js index 5849669c..62668c92 100644 --- a/app/components/Layout.js +++ b/app/components/Layout.js @@ -15,7 +15,6 @@ import ErrorSuspended from "scenes/ErrorSuspended"; import KeyboardShortcuts from "scenes/KeyboardShortcuts"; import Analytics from "components/Analytics"; import DocumentHistory from "components/DocumentHistory"; -import { GlobalStyles } from "components/DropToImport"; import Flex from "components/Flex"; import { LoadingIndicatorBar } from "components/LoadingIndicator"; @@ -138,7 +137,6 @@ class Layout extends React.Component { > - ); } diff --git a/app/components/Sidebar/components/CollectionLink.js b/app/components/Sidebar/components/CollectionLink.js index b427f9d3..1182500b 100644 --- a/app/components/Sidebar/components/CollectionLink.js +++ b/app/components/Sidebar/components/CollectionLink.js @@ -41,11 +41,7 @@ class CollectionLink extends React.Component { return ( <> - +