diff --git a/react/components/Menu/ProfilePicture/BaseDropzone.tsx b/react/components/Menu/ProfilePicture/BaseDropzone.tsx deleted file mode 100644 index 09e3398d..00000000 --- a/react/components/Menu/ProfilePicture/BaseDropzone.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { Component } from 'react' -import ReactDropzone from 'react-dropzone' - -const MAX_SIZE = 4 * 1024 * 1024 - -class BaseDropzone extends Component { - public state = { - isHovering: false, - } - - private handleStartHovering = () => { - this.setState({ isHovering: true }) - } - - private handleStopHovering = () => { - this.setState({ isHovering: false }) - } - - private handleDrop = (files: any) => { - this.setState({ isHovering: false }) - this.props.onDrop(files) - } - - public render() { - const { disabled, children, onClick } = this.props - const { isHovering } = this.state - return ( - - {children} - - ) - } -} - -interface Props { - disabled: boolean - onClick: () => void - onDrop: (files: any) => void -} - -export default BaseDropzone diff --git a/react/components/Menu/ProfilePicture/PictureUploader.tsx b/react/components/Menu/ProfilePicture/PictureUploader.tsx deleted file mode 100644 index 1c5740b5..00000000 --- a/react/components/Menu/ProfilePicture/PictureUploader.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { Component, Fragment } from 'react' -import { FormattedMessage } from 'react-intl' -import { Button, Spinner } from 'vtex.styleguide' -import { GenericError } from 'vtex.my-account-commons' - -import BaseDropzone from './BaseDropzone' -import PictureRenderer from './PictureRenderer' - -class PictureUploader extends Component { - public state = { - error: null, - isLoading: false, - finishedUpload: false, - previewPicture: null, - file: null, - } - - private handleImageDrop = async (acceptedFiles: any) => { - if (acceptedFiles && acceptedFiles[0]) { - this.setState({ - error: null, - finishedUpload: true, - previewPicture: URL.createObjectURL(acceptedFiles[0]), - file: acceptedFiles[0], - }) - } else { - this.setState({ error: 'alert.fileTooBig' }) - } - } - - private handleErrorReset = () => { - this.setState({ error: null }) - } - - private handleSaveClick = async (event: any) => { - event.stopPropagation() - this.props.onCloseClick() - } - - public render() { - const { currentPicture } = this.props - const { error, isLoading, finishedUpload, previewPicture } = this.state - const boxText = finishedUpload - ? 'upload.photoUpdated' - : 'upload.dragYourPhoto' - - return ( - - {error && ( -
- -
- )} - -
- {isLoading ? ( - - -
- -
-
- ) : ( - -
- -
-
- -
- {finishedUpload ? ( - -
- -
- -
- ) : ( - -
-
- - - -
-
- - - )} - - )} -
- - - ) - } -} - -interface Props { - currentPicture?: string - onCloseClick: () => void -} - -export default PictureUploader diff --git a/react/components/Menu/ProfilePicture/UserPicture.tsx b/react/components/Menu/ProfilePicture/UserPicture.tsx deleted file mode 100644 index 02288812..00000000 --- a/react/components/Menu/ProfilePicture/UserPicture.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, { Component } from 'react' -import { Modal } from 'vtex.styleguide' - -import PictureUploader from './PictureUploader' -import PictureRenderer from './PictureRenderer' - -class UserPicture extends Component { - public state = { - isModalOpen: false, - } - - private handleOpenModal = () => { - this.setState({ isModalOpen: true }) - } - - private handleCloseModal = () => { - this.setState({ isModalOpen: false }) - } - - public render() { - const { imagePath } = this.props - const { isModalOpen } = this.state - - return ( - - - - -
- -
-
-
- ) - } -} - -interface Props { - imagePath?: string -} - -export default UserPicture