Skip to content

Commit 1321aea

Browse files
author
Jonatan Salas
committed
#2 Definitive styles for now
1 parent f1ae1c1 commit 1321aea

File tree

3 files changed

+27
-37
lines changed

3 files changed

+27
-37
lines changed

src/components/common/DropZone.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,20 @@ export default class DropZone extends Component {
191191

192192
if (!className && !style && !activeStyle && !rejectStyle) {
193193
style = {
194+
backgroundColor: "#f5f5f5",
194195
width: 'auto',
195196
borderWidth: 1,
196-
borderColor: '#bdbdbd',
197+
borderColor: '#757575',
197198
borderStyle: 'dashed',
198199
borderRadius: 2
199200
};
200201
activeStyle = {
201202
borderStyle: 'solid',
202-
backgroundColor: '#eee'
203+
backgroundColor: '#f5f5f5'
203204
};
204205
rejectStyle = {
205206
borderStyle: 'solid',
206-
backgroundColor: '#ffdddd'
207+
backgroundColor: '#f5f5f5'
207208
};
208209
}
209210

src/components/common/FileInfo.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ export default class FileUploadItem extends Component {
1818
render() {
1919
let { file, height, width } = this.props;
2020

21-
//TODO truncate fileName to keep the Col in the same height
2221
const containerStyle = {
23-
backgroundColor: "#e0e0e0",
24-
paddingTop: "10px",
25-
paddingBottom: "10px"
22+
margin: "auto",
23+
padding: "0px",
24+
backgroundColor: "#eeeeee",
25+
borderColor: '#757575',
26+
borderStyle: 'solid',
27+
borderWidth: 2,
28+
borderRadius: 6,
29+
marginBottom: "10px"
2630
};
2731

2832
const fileNameStyle = {
@@ -35,27 +39,27 @@ export default class FileUploadItem extends Component {
3539
};
3640

3741
const imgStyle = {
42+
marginTop: "10px",
3843
display: 'block',
3944
marginLeft: 'auto',
4045
marginRight: 'auto'
4146
};
4247

43-
//TODO check this
44-
let image = (file.type.match(/image/))? file.preview : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAVFBMVEW9w8f///+Vpaa8ws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gAUEP4HFbW8R4pmC52hrBo9muP39t+KMKFdVHgH05NUdTBwtYWBfpZvy8K2wYL36/vx8O+Nt2NI7TvwcJDN/5+g0zcNeMIu0Ow8NTdHinDPaBebuPrTsHCvL39BYt6uDH3t0w6d0OP8HCfxKJBvLgpm/vg3BupR5g3Xw8/NgbroNqbx9DcBI/waxKv22pTGaP8as7vM6ZqHm9B9UyhT5jXui9UnZ51nu4FwhO80HkgFQjzX53/U1as++UDeIXPuyJevp1QJESeRf8MioT5a41p7OpXweglwjw/WjxjZ4+iscuEo7HqLM5h1dqukvnkwjw/H9/aqvF/+uI1Vft2PIvH/Qe0D6lLW0grSAAAAABJRU5ErkJggg==";
48+
const textContainerStyle = {
49+
marginTop: "10px",
50+
color: "#212121"
51+
};
52+
53+
let image = (file.type.match(/image/))? file.preview : "http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/file-text-icon.png";
54+
let filename = (file.name.length <= 21)? file.name : file.name.substring(0, 20);
4555

4656
return (
4757
<Col xs={4} md={4}>
4858
<div style={containerStyle}>
49-
<div>
50-
<img height={height} width={width} src={image} style={imgStyle}/>
51-
</div>
52-
<div>
53-
<p style={fileNameStyle}>
54-
<a>{file.name}</a>
55-
</p>
56-
<p style={fileSizeStyle}>
57-
{filesize(file.size)}
58-
</p>
59+
<img height={height} width={width} src={image} style={imgStyle}/>
60+
<div style={textContainerStyle}>
61+
<p style={fileNameStyle}>{filename}</p>
62+
<p style={fileSizeStyle}>{filesize(file.size)}</p>
5963
</div>
6064
</div>
6165
</Col>

src/components/field/FileUpload.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,11 @@ export default class FileUpload extends Component {
1616
};
1717

1818
onDrop = (files) => {
19-
let fileArray = this.filter([...files, ...this.state.files]);
19+
let fileArray = [...files, ...this.state.files];
2020

2121
this.setState({ files: fileArray });
2222
};
2323

24-
//TODO JS: Create a correct filter..
25-
filter = (array) => {
26-
// let a = [];
27-
//
28-
// array.forEach((item) => {
29-
// if (a.indexOf(item) < 0) {
30-
// a.push(item);
31-
// }
32-
// });
33-
34-
return Array.from(new Set(array));
35-
};
36-
3724
onClick = () => {
3825
// TODO Handle response status for upload service
3926
const { files } = this.state;
@@ -54,7 +41,6 @@ export default class FileUpload extends Component {
5441
render() {
5542
let { files } = this.state;
5643

57-
//TODO Think how to manage styles correctly
5844
const attachmentStyle = {
5945
marginTop: "6px",
6046
color: "#616161"
@@ -71,10 +57,9 @@ export default class FileUpload extends Component {
7157

7258
let rowStyle = {};
7359

74-
//TODO check row
7560
if (files) {
7661
rowStyle = {
77-
padding: "10px"
62+
padding: "5px"
7863
}
7964
}
8065

@@ -105,7 +90,7 @@ export default class FileUpload extends Component {
10590
</Col>
10691
</Row>
10792
<Col>
108-
<GlyphButton type="submit" glyph="cloud-upload" text="Upload" bsSize="primary" onClick={this.onClick}/>
93+
<GlyphButton type="submit" glyph="cloud-upload" text="Upload" bsSize="sm" bsStyle="primary" onClick={this.onClick}/>
10994
</Col>
11095
</div>
11196
);

0 commit comments

Comments
 (0)