Prettify rest of the components files except stats
This commit is contained in:
@@ -10,17 +10,16 @@ import { getNavigation, navigate } from '../../slices/navigation'
|
||||
import { Colors, Containers, Fonts, Sizes, Spacing } from '../../styles'
|
||||
|
||||
const MenuItem = ({ component, icon, label, navigate, navigation }) => {
|
||||
const isActive = (component === navigation.currentPage)
|
||||
const isActive = component === navigation.currentPage
|
||||
const textStyle = isActive ? styles.menuTextActive : styles.menuText
|
||||
const testID = isActive ? 'activeMenuItem' : `menuItem${label}`
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={styles.button}
|
||||
onPress={() => navigate(component)}
|
||||
>
|
||||
<Icon name={icon} isActive={isActive}/>
|
||||
<Text testID={testID} style={textStyle} >{label}</Text>
|
||||
<TouchableOpacity style={styles.button} onPress={() => navigate(component)}>
|
||||
<Icon name={icon} isActive={isActive} />
|
||||
<Text testID={testID} style={textStyle}>
|
||||
{label}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
@@ -36,37 +35,34 @@ MenuItem.propTypes = {
|
||||
const text = {
|
||||
fontFamily: Fonts.bold,
|
||||
fontSize: Sizes.small,
|
||||
textTransform: 'uppercase'
|
||||
textTransform: 'uppercase',
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
padding: Spacing.base,
|
||||
...Containers.centerItems
|
||||
...Containers.centerItems,
|
||||
},
|
||||
menuText: {
|
||||
color: Colors.grey,
|
||||
...text
|
||||
...text,
|
||||
},
|
||||
menuTextActive: {
|
||||
color: Colors.orange,
|
||||
...text
|
||||
}
|
||||
...text,
|
||||
},
|
||||
})
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return({
|
||||
return {
|
||||
navigation: getNavigation(state),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return({
|
||||
return {
|
||||
navigate: (page) => dispatch(navigate(page)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(MenuItem)
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(MenuItem)
|
||||
|
||||
Reference in New Issue
Block a user