Skip to content

Commit 34c0015

Browse files
committed
style for message and switching between progress and message
1 parent 7c25cf0 commit 34c0015

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

plugins/overlays/download.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ const { disableAuto, reloadDevices, updateSelected } = require('../../src/action
1313

1414
const styles = require('./styles');
1515

16-
function componentizeUserMessage(message){
17-
let messageBox;
18-
if(message) {
19-
messageBox = <div style={styles.overlayUserMessage}>{message}</div>;
20-
}
21-
else {
22-
messageBox = null;
23-
}
24-
25-
return messageBox;
26-
}
27-
2816
class DownloadOverlay extends React.Component {
2917

3018
constructor(){
@@ -49,12 +37,22 @@ class DownloadOverlay extends React.Component {
4937
const { devices, devicePath, message, progress, searching } = this.props;
5038

5139
const deviceRows = _.map(devices, (device) => this.componentizeDevice(device, devicePath));
52-
const userMessage = componentizeUserMessage(message);
40+
41+
let bottomBar;
42+
if(message){
43+
bottomBar = (
44+
<div style={styles.overlayUserMessage}>{message}</div>
45+
);
46+
} else {
47+
bottomBar = (
48+
<Progress percent={progress} />
49+
);
50+
}
5351

5452
return (
55-
<Card styles={[styles.overlay, styles.overlayLarge]}>
56-
<h3 style={styles.overlayTitle}>Please choose your connected device.</h3>
57-
<div>
53+
<Card styles={[styles.overlay, styles.overlayLarge, styles.overlayUnpad]}>
54+
<h3 styles={[styles.overlayTitle, styles.overlayPad]}>Please choose your connected device.</h3>
55+
<div style={styles.overlayPad}>
5856
<Loader loaded={!searching}>
5957
<div style={styles.deviceTableWrapper}>
6058
<div style={styles.deviceTableScroll}>
@@ -74,20 +72,17 @@ class DownloadOverlay extends React.Component {
7472
</div>
7573
</Loader>
7674
</div>
77-
<div>
78-
</div>
79-
80-
{userMessage}
81-
82-
<div style={styles.overlayDevicesBottom}>
75+
<div styles={[styles.overlayDevicesBottom, styles.overlayPad]}>
8376
<div style={styles.overlayLoadingContainer}>
8477
<Button onClick={this._onReloadDevices}>Refresh</Button>
8578
</div>
8679
<div style={styles.overlayButtonContainer}>
8780
<Button onClick={this._onCancel}>Cancel</Button>
8881
</div>
8982
</div>
90-
<Progress percent={progress} />
83+
<div style={styles.bottomBar}>
84+
{bottomBar}
85+
</div>
9186
</Card>
9287
);
9388
}

plugins/overlays/styles.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ const styles = {
1818
overlayLarge: StyleSheet.create({
1919
height: 400
2020
}),
21+
overlayUnpad: {
22+
padding: '16px 0 0'
23+
},
24+
overlayPad: {
25+
padding: '0 16px'
26+
},
2127
overlayTitle: {
2228
margin: 0
2329
},
@@ -37,21 +43,21 @@ const styles = {
3743
marginTop: 20
3844
},
3945
overlayUserMessage: {
40-
display: 'flex',
41-
margin: '20px',
4246
color: '#911',
4347
backgroundColor: '#fcdede',
44-
border: '1px solid #d2b2b2',
45-
borderRadius: '3px',
46-
padding: '10px'
48+
padding: '10px 16px',
49+
textAlign: 'center',
50+
width: '100%'
51+
},
52+
bottomBar: {
53+
height: '39px',
54+
display: 'flex'
4755
},
4856
progressContainerStyle: {
4957
width: '100%',
5058
height: '8px',
5159
backgroundColor: '#b0d0ef',
52-
position: 'absolute',
53-
bottom: 0,
54-
left: 0
60+
marginTop: 'auto'
5561
},
5662
progressBarStyle: {
5763
height: '100%',

src/stores/device.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class DeviceStore {
7575

7676
this.setState({
7777
devicePath: device.path,
78-
selectedDevice: device
78+
selectedDevice: device,
79+
message: null
7980
});
8081

8182
this._download();

0 commit comments

Comments
 (0)