making file upload widget more consistent visually

This commit is contained in:
or-else
2018-06-06 10:15:39 +03:00
parent 2c21a34d07
commit 2f307e2803
2 changed files with 22 additions and 45 deletions
+17 -26
View File
@@ -1703,33 +1703,24 @@ ul.tabbar li.active > a:after {
}
/* File upload styles */
.upload-container {
width: 2rem;
height: 2rem;
padding: 0;
margin: 0;
.uploader {
display: flex;
}
/* Gray uploader bar of fixed length (background) */
.uploader > div {
position: relative;
background-color: #CCF;
border-radius: 50%;
height: 0.6rem;
padding: 0.15rem;
margin: 0.3rem;
width: 6rem;
border-radius: 0.1rem;
background-color: silver;
}
.upload-container .half {
/* Colored uploader progress bar of variable length */
.uploader > div > span {
position: absolute;
top: 0; left: 0; width: 1rem; height: 2rem;
border-radius: 1rem 0 0 1rem;
transform-origin: 1rem 1rem;
}
.upload-container .half.active {
background-color: #66F;
}
.upload-container .half.clip {
background-color: #CCF;
}
.upload-container .inner {
font-size: 80%;
position: absolute;
top: 0.25rem; left: 0.25rem; right: 0.25rem; bottom: 0.25rem;
text-align: center;
line-height: 1.5rem;
border-radius: 50%;
background-color: white;
display: inline-block;
height: 0.3rem;
background-color: #1e88e5;
border-radius: 0.08rem;
}
+5 -19
View File
@@ -703,30 +703,15 @@
super(props);
this.state = {
progress: 0
progress: 0.33
};
}
render() {
var halfclip, progress1, progress2;
if (this.state.progress < 0.5) {
halfclip = {display: "block"};
progress1 = {transform: "rotate(" + (this.state.progress*360) + "deg)"};
progress2 = {display: "none"};
} else {
halfclip = {display: "none"};
progress1 = {transform: "rotate(180deg)"};
progress2 = {display: "block", transform: "rotate(" + (180 + (this.state.progress-0.5)*360) + "deg)"};
}
return (
<div className="upload-container">
<div className="half active" style={progress1}></div>
<div className="half clip" style={halfclip}></div>
<div className="half active" style={progress2}></div>
<div className="inner">{this.props.onCancel ?
<MenuCancel onCancel={this.props.onCancel} /> :
null}
</div>
<div className="uploader">
<div><span style={{width: (this.state.progress * 100) + "%"}}></span></div>
<a href="javascript:;" onClick={this.props.onCancel}><i className="material-icons">close</i> cancel</a>
</div>
);
}
@@ -1576,6 +1561,7 @@
onError={this.props.onError} /> :
null}
<FileUploadProgress />
</div>
);
}