From 56992b74e38d13115460ae87ec2fa69180fbb91f Mon Sep 17 00:00:00 2001 From: srgooglo <38926803+srgooglo@users.noreply.github.com> Date: Wed, 11 Mar 2020 20:04:34 +0100 Subject: [PATCH] 0.2.11A2 --- src/components/PostCreator/index.js | 37 +++++++++++++++++---------- src/components/PostCreator/index.less | 9 ++++++- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js index d7a75f1a..d49a959f 100755 --- a/src/components/PostCreator/index.js +++ b/src/components/PostCreator/index.js @@ -38,6 +38,7 @@ class PostCreator extends React.PureComponent{ uploader: false, } } + renderPostPlayer(payload){ const {file, fileURL} = this.state const videofilter = file.type === 'video/mp4' @@ -46,7 +47,7 @@ class PostCreator extends React.PureComponent{ return (
- null} icon={} /> + this.handleDeleteFile()} icon={} />
@@ -58,9 +59,14 @@ class PostCreator extends React.PureComponent{ if (videofilter) { return (
- +
+ this.handleDeleteFile()} icon={} /> +
+
+ +
) } @@ -74,10 +80,12 @@ class PostCreator extends React.PureComponent{ ToogleUpload(){ this.setState({ uploader: !this.state.uploader }) } - + handleDeleteFile = () =>{ + this.setState({ fileURL: null }) + } handleFileUpload = info => { if (info.file.status === 'uploading') { - this.setState({ loading: true }); + this.setState({ loading: true, }); return; } if (info.file.status === 'done') { @@ -176,6 +184,15 @@ class PostCreator extends React.PureComponent{ div.removeEventListener('dragleave', this.handleDragOut) } + canPost(){ + const { fileURL, keys_remaining, } = this.state + + const isTypedSomething = (keys_remaining < ycore.DevOptions.MaxLengthPosts) + const isUploadedFile = (fileURL? true : false) + + return isUploadedFile || isTypedSomething + } + render(){ const { keys_remaining, visible, fileURL, file } = this.state; const percent = (((keys_remaining/ycore.DevOptions.MaxLengthPosts) * 100).toFixed(2) ) @@ -196,9 +213,7 @@ class PostCreator extends React.PureComponent{ return(
-
- {this.state.uploader?
-
: (this.state.posting? : )} />
+
: (this.state.posting? : )} />
} - - - -
{fileURL? this.renderPostPlayer(this.state.fileURL) : null} diff --git a/src/components/PostCreator/index.less b/src/components/PostCreator/index.less index a5aced72..3432c455 100755 --- a/src/components/PostCreator/index.less +++ b/src/components/PostCreator/index.less @@ -207,15 +207,22 @@ height: 100%; // top: -100px; margin: 0 0 15px 0; + background-color: #eeeeee; .imagePreview{ z-index: 5; position: relative; + width: 50%; margin: auto; border-radius: 8px; + transition: all 150ms linear; img{ width: 100%; border: 0.5px rgba(56, 56, 56, 0.459) solid; } + video{ + width: 100%; + border: 0.5px rgba(56, 56, 56, 0.459) solid; + } transition: all 150ms linear; } @@ -224,7 +231,7 @@ position: relative; opacity: 0; transition: all 150ms linear; - + margin: auto; } } .imagePreviewWrapper:hover .imagePreview{