From c44eeff8f1d962122e4b38e78574ee9bd7b093bc Mon Sep 17 00:00:00 2001 From: srgooglo <38926803+srgooglo@users.noreply.github.com> Date: Thu, 5 Mar 2020 21:54:50 +0100 Subject: [PATCH] 0.2.05A2 --- src/components/PostCreator/index.js | 54 ++++++++++++++++++--------- src/components/PostCreator/index.less | 27 ++++++++++++-- 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js index c002c7af..17659e6d 100755 --- a/src/components/PostCreator/index.js +++ b/src/components/PostCreator/index.js @@ -48,12 +48,13 @@ class PostCreator extends React.PureComponent{ } handleFileUpload = info => { - console.log('handle') + console.log(info.file.originFileObj) if (info.file.status === 'uploading') { this.setState({ loading: true }); return; } if (info.file.status === 'done') { + this.ToogleUpload() // Get this url from response in real world. getBase64(info.file.originFileObj, imageUrl => this.setState({ @@ -93,7 +94,7 @@ class PostCreator extends React.PureComponent{ } handlePublishPost = (e) => { - const { rawtext, shareWith, imageUrl} = this.state; + const { rawtext, shareWith, imageUrl } = this.state; let postFile; if (imageUrl) { console.log('EXIST ',imageUrl) @@ -114,6 +115,21 @@ class PostCreator extends React.PureComponent{ RefreshFeed() }) } + OpenControl = () =>{ + let controls = [( +
this.ResetUpload()} icon={} />
+ )] + ycore.ControlBar.set(controls) + } + CloseControl = () =>{ + ycore.ControlBar.close() + } + ResetUpload (){ + this.setState({ + imageUrl: null + }) + this.ToogleUpload() + } render(){ const { keys_remaining, visible } = this.state; @@ -122,7 +138,6 @@ class PostCreator extends React.PureComponent{ this.setState({ shareWith: key }) } - const shareOptionsMenu = ( {ycore.GetPostPrivacy.decorator("any")} @@ -130,40 +145,45 @@ class PostCreator extends React.PureComponent{ {ycore.GetPostPrivacy.decorator("only_followers")} {ycore.GetPostPrivacy.decorator("private")} - ) + ) + if (visible) { return(
{this.state.UploadActive? +
-

- -

-

Click or drag file to this area to upload

-

- Support for a single or bulk upload. -

+
+

+ +

+

Click or drag file to this area to upload

+
+
: -
+ <>
: (this.state.posting? : )} />
-
} + }
- + { this.state.imageUrl? +
+ +
: null + } this.ToogleUpload()} > diff --git a/src/components/PostCreator/index.less b/src/components/PostCreator/index.less index 74dc353d..b1e04e74 100755 --- a/src/components/PostCreator/index.less +++ b/src/components/PostCreator/index.less @@ -158,12 +158,31 @@ } } -.avatar-uploader > .ant-upload { - width: 128px; - height: 128px; - +.uploader { + display: flex; + position: relative; + z-index: 30; + width: 100%; + height: 100%; + span{ + width: 100%; + } } +.imagePreviewWrapper{ + display: flex; + position: relative; + z-index: 30; + width: 100%; + height: 100%; + margin: 15px 0 15px 0; + .imagePreview{ + margin: auto; + max-width: 300px; + object-fit: cover; + border-radius: 8px; + } +} .proccessUnset{ opacity: 0;