Skip to content
This repository has been archived by the owner on Aug 8, 2021. It is now read-only.

Commit

Permalink
refactor refreshButton component
Browse files Browse the repository at this point in the history
Improve accessibility
related #4
  • Loading branch information
juliomatcom committed Nov 11, 2017
1 parent 81563e0 commit 867efd3
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 20 deletions.
Binary file removed assets/img/plus.png
Binary file not shown.
Binary file removed assets/img/plusDisabled.png
Binary file not shown.
Binary file added assets/img/refresh-circle-secundary.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/refresh.png
Binary file not shown.
21 changes: 4 additions & 17 deletions src/BottomNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const styles = StyleSheet.create({
padding: 8
},
bottomBtn: {
width: 36,
height: 36
width: 32,
height: 32
},
font10: {
fontSize: 10
Expand All @@ -33,6 +33,8 @@ const styles = StyleSheet.create({
alignItems: 'center',
}
})
const importBtn = require('../assets/img/download.png')
const settingsBtn = require('../assets/img/settings.png')

export default class BottomNav extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -61,10 +63,6 @@ export default class BottomNav extends React.Component {
}

render() {
const importBtn = require('../assets/img/download.png')
const refreshButton = require('../assets/img/refreshSecundary.png')
const settingsBtn = require('../assets/img/settings.png')

return (
<View style={styles.navigation}>
<View style={styles.bottomGrid}>
Expand All @@ -75,17 +73,6 @@ export default class BottomNav extends React.Component {
</View>
</TouchableHighlight>
</View>
<View style={styles.bottomGrid}>
<TouchableHighlight key="refresh" underlayColor='transparent' onPress={this.mainComponent.refresh}>
<View style={styles.col}>
<Image
style={styles.bottomBtn}
source={refreshButton}>
</Image>
<Text style={styles.font10}>Refresh</Text>
</View>
</TouchableHighlight>
</View>
<View style={styles.bottomGrid}>
<View style={styles.col}>
<TouchableHighlight key="confs" underlayColor='transparent' onPress={this.openPreferences}>
Expand Down
2 changes: 1 addition & 1 deletion src/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const style = StyleSheet.create({
borderTopWidth: 0,
borderRightWidth: 0,
borderLeftWidth: 0,
padding: 10,
padding: 15,
marginTop: 3,
backgroundColor: 'white'
},
Expand Down
19 changes: 19 additions & 0 deletions src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import {
NetInfo,
StyleSheet,
TouchableHighlight,
Text,
View
} from 'react-native'
import List from './List'
import Welcome from './Welcome'
import Footer from './Footer'
import BottomNav from './BottomNav'
import ActivityIndicatorLayer from './ActivityIndicatorLayer'
import RefreshButton from './components/Main/RefreshButton'
import {STG_ADDRESSES, STG_STATE, CURRENCIES} from './lib/constants'
import API from './lib/api'
import {convertBalanceFromWei} from './lib/utils'
Expand Down Expand Up @@ -319,9 +321,18 @@ export default class Main extends React.Component {
<List screenProps={screenProps} date={this.state.date} items={this.state.accounts}></List>
return (
<View style={styles.container}>
{
this.state.accounts.length ?
<RefreshButton action={this.refresh}/> :
undefined
}
<View style={[appStyles.center, styles.homeTitle]}>
<Text style={styles.homeTitleText}>Addresses</Text>
</View>
<View style={offlineStyle}>
<Image source={offlineImg} style={styles.img}/>
</View>

{
this.state.loading ?
<ActivityIndicatorLayer animating={true}></ActivityIndicatorLayer> :
Expand All @@ -344,5 +355,13 @@ const styles = StyleSheet.create({
img: {
width: 32,
height: 32
},
homeTitle: {
backgroundColor: appStyles.color.primary[400],
height: 32
},
homeTitleText: {
fontSize: 16,
color: appStyles.color.white
}
})
7 changes: 6 additions & 1 deletion src/Welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import List from './List'
import appStyles from './lib/styles'

const styles = StyleSheet.create({
flex: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
warning: {
padding: 20
},
Expand All @@ -29,7 +34,7 @@ export default class Welcome extends React.Component {

render() {
return (
<View style={appStyles.container}>
<View style={[appStyles.container, styles.flex]}>
<Warning customStyles={styles.warning} msg='No accounts found'></Warning>
<Warning customStyles={styles.warning} msg='Please import an Ethereum Address to track.'></Warning>
<View style={styles.picContainer}>
Expand Down
34 changes: 34 additions & 0 deletions src/components/Main/RefreshButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react'
import {
Image,
TouchableHighlight,
StyleSheet
} from 'react-native'

const styles = StyleSheet.create({
refreshTouch: {
position: 'absolute',
top: 5,
right: 15,
zIndex: 100,
},
refreshButton: {
width: 48,
height: 48
}
})

const refreshButtonImg = require('../../../assets/img/refresh-circle-secundary.png')

export default class RefreshButton extends React.Component {
constructor(props) {
super(props)
}
render() {
return (
<TouchableHighlight style={styles.refreshTouch} underlayColor='transparent' onPress={this.props.action}>
<Image source={refreshButtonImg} style={styles.refreshButton}/>
</TouchableHighlight>
)
}
}
2 changes: 1 addition & 1 deletion src/lib/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
paddingTop: 20,
paddingBottom: 20,
backgroundColor: '#1B5E20',
height: 96,
height: 96
},
headerTitleMain: {
fontSize: 22,
Expand Down

0 comments on commit 867efd3

Please sign in to comment.