Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit f3befd8

Browse files
committed
Move navigation buttons on home screen around
1 parent 4577d9c commit f3befd8

File tree

1 file changed

+17
-80
lines changed

1 file changed

+17
-80
lines changed

src/view/home.js

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { StyleSheet, View } from 'react-native';
2+
import { StyleSheet, View, Platform } from 'react-native';
33
import { observer } from 'mobx-react';
44
import PropTypes from 'prop-types';
55
import Background from '../component/background';
@@ -9,14 +9,14 @@ import { Alert } from '../component/notification';
99
import { color } from '../component/style';
1010
import { H4Text } from '../component/text';
1111
import Icon from '../component/icon';
12-
import ChannelIcon from '../asset/icon/channel';
12+
import QrIcon from '../asset/icon/qr';
1313
import LightningBoltPurpleIcon from '../asset/icon/lightning-bolt-purple';
1414
import {
1515
BalanceLabel,
1616
BalanceLabelNumeral,
1717
BalanceLabelUnit,
1818
} from '../component/label';
19-
import { Button, QrButton, GlasButton, DownButton } from '../component/button';
19+
import { Button, GlasButton, DownButton } from '../component/button';
2020

2121
//
2222
// Home View
@@ -50,18 +50,17 @@ const HomeView = ({
5050
return (
5151
<Background image="purple-gradient-bg">
5252
<HomeHeader
53-
goChannels={() => channel.init()}
53+
goDeposit={() => nav.goDeposit()}
5454
goSettings={() => nav.goSettings()}
55-
showChannelAlert={store.showChannelAlert}
5655
/>
57-
<QrCodeSeparator goDeposit={() => nav.goDeposit()} />
5856
<MainContent style={styles.content}>
5957
<BalanceDisplay
6058
totalBalanceLabel={totalBalanceLabel}
6159
unitLabel={unitLabel}
6260
channelStatus={channelStatus}
6361
channelPercentageLabel={channelPercentageLabel}
6462
toggleDisplayFiat={() => wallet.toggleDisplayFiat()}
63+
goChannels={() => channel.init()}
6564
/>
6665
<SendReceiveButton
6766
goPay={() => payment.init()}
@@ -93,13 +92,10 @@ const balanceStyles = StyleSheet.create({
9392
wrapper: {
9493
flex: 1,
9594
justifyContent: 'center',
96-
alignItems: 'center',
95+
marginTop: 30,
9796
},
98-
percentWrapper: {
97+
percentBtn: {
9998
flexDirection: 'row',
100-
alignItems: 'center',
101-
marginTop: 20,
102-
marginBottom: 5,
10399
},
104100
alert: {
105101
marginRight: 6,
@@ -112,6 +108,7 @@ const BalanceDisplay = ({
112108
channelStatus,
113109
channelPercentageLabel,
114110
toggleDisplayFiat,
111+
goChannels,
115112
}) => (
116113
<View style={balanceStyles.wrapper}>
117114
<Button onPress={toggleDisplayFiat}>
@@ -120,10 +117,10 @@ const BalanceDisplay = ({
120117
<BalanceLabelUnit>{unitLabel}</BalanceLabelUnit>
121118
</BalanceLabel>
122119
</Button>
123-
<View style={balanceStyles.percentWrapper}>
120+
<Button onPress={goChannels} style={balanceStyles.percentBtn}>
124121
<Alert type={channelStatus} style={balanceStyles.alert} />
125122
<H4Text>{channelPercentageLabel}</H4Text>
126-
</View>
123+
</Button>
127124
</View>
128125
);
129126

@@ -133,6 +130,7 @@ BalanceDisplay.propTypes = {
133130
channelStatus: PropTypes.string.isRequired,
134131
channelPercentageLabel: PropTypes.string.isRequired,
135132
toggleDisplayFiat: PropTypes.func.isRequired,
133+
goChannels: PropTypes.func.isRequired,
136134
};
137135

138136
//
@@ -184,31 +182,9 @@ SendReceiveButton.propTypes = {
184182
//
185183

186184
const headerStyles = StyleSheet.create({
187-
btnWrapperLeft: {
188-
width: 150,
189-
flexDirection: 'row',
190-
justifyContent: 'flex-start',
191-
},
192-
btnWrapperRight: {
193-
width: 150,
194-
flexDirection: 'row',
195-
justifyContent: 'flex-end',
196-
},
197-
channelBtn: {
185+
depositBtn: {
198186
marginLeft: 3,
199187
},
200-
channelAlert: {
201-
position: 'absolute',
202-
top: 17,
203-
right: 21,
204-
height: 10,
205-
width: 10,
206-
backgroundColor: color.pinkSig,
207-
borderColor: color.white,
208-
borderRadius: 50,
209-
borderStyle: 'solid',
210-
borderWidth: 2,
211-
},
212188
settingsBtn: {
213189
marginRight: 3,
214190
},
@@ -218,11 +194,10 @@ const headerStyles = StyleSheet.create({
218194
},
219195
});
220196

221-
const HomeHeader = ({ goChannels, goSettings, showChannelAlert }) => (
222-
<Header>
223-
<Button onPress={goChannels} style={headerStyles.channelBtn}>
224-
<ChannelIcon height={24 * 0.9} width={25 * 0.9} />
225-
{showChannelAlert ? <View style={headerStyles.channelAlert} /> : null}
197+
const HomeHeader = ({ goDeposit, goSettings }) => (
198+
<Header separator={Platform.OS === 'web'}>
199+
<Button onPress={goDeposit} style={headerStyles.depositBtn}>
200+
<QrIcon height={40 * 0.6} width={39 * 0.6} />
226201
</Button>
227202
<Title title="Wallet" />
228203
<Button onPress={goSettings} style={headerStyles.settingsBtn}>
@@ -235,46 +210,8 @@ const HomeHeader = ({ goChannels, goSettings, showChannelAlert }) => (
235210
);
236211

237212
HomeHeader.propTypes = {
238-
goChannels: PropTypes.func.isRequired,
239-
goSettings: PropTypes.func.isRequired,
240-
showChannelAlert: PropTypes.bool.isRequired,
241-
};
242-
243-
//
244-
// QR Code Separator
245-
//
246-
247-
const qrStyles = StyleSheet.create({
248-
wrapper: {
249-
alignSelf: 'stretch',
250-
flexDirection: 'row',
251-
alignItems: 'flex-start',
252-
height: 30,
253-
top: -1,
254-
},
255-
separator: {
256-
flex: 1,
257-
height: 1,
258-
shadowOffset: { width: 0, height: 0.25 },
259-
shadowColor: color.white,
260-
},
261-
button: {
262-
top: -19,
263-
},
264-
});
265-
266-
const QrCodeSeparator = ({ goDeposit }) => (
267-
<View style={qrStyles.wrapper}>
268-
<View style={qrStyles.separator} />
269-
<QrButton onPress={goDeposit} style={qrStyles.button}>
270-
Add coin
271-
</QrButton>
272-
<View style={qrStyles.separator} />
273-
</View>
274-
);
275-
276-
QrCodeSeparator.propTypes = {
277213
goDeposit: PropTypes.func.isRequired,
214+
goSettings: PropTypes.func.isRequired,
278215
};
279216

280217
export default observer(HomeView);

0 commit comments

Comments
 (0)