Extract navigation arrow and give it more padding
This commit is contained in:
@@ -3,8 +3,8 @@ import {
|
|||||||
View,
|
View,
|
||||||
Text} from 'react-native'
|
Text} from 'react-native'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import styles, { iconStyles } from '../../styles'
|
import styles from '../../styles'
|
||||||
import Icon from 'react-native-vector-icons/Entypo'
|
import NavigationArrow from './navigation-arrow'
|
||||||
|
|
||||||
export default function CycleDayHeader(props) {
|
export default function CycleDayHeader(props) {
|
||||||
return (<View style={[styles.header, styles.headerCycleDay]}>
|
return (<View style={[styles.header, styles.headerCycleDay]}>
|
||||||
@@ -12,7 +12,7 @@ export default function CycleDayHeader(props) {
|
|||||||
style={styles.accentCircle}
|
style={styles.accentCircle}
|
||||||
left={props.middle - styles.accentCircle.width / 2}
|
left={props.middle - styles.accentCircle.width / 2}
|
||||||
/>
|
/>
|
||||||
<Icon name='chevron-thin-left' {...iconStyles.navigationArrow} onPress={() => props.goToCycleDay('before')} />
|
<NavigationArrow direction='left' {...props}/>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.dateHeader}>
|
<Text style={styles.dateHeader}>
|
||||||
{moment(props.date).format('MMMM Do YYYY')}
|
{moment(props.date).format('MMMM Do YYYY')}
|
||||||
@@ -22,7 +22,7 @@ export default function CycleDayHeader(props) {
|
|||||||
Cycle day {props.cycleDayNumber}
|
Cycle day {props.cycleDayNumber}
|
||||||
</Text>}
|
</Text>}
|
||||||
</View>
|
</View>
|
||||||
<Icon name='chevron-thin-right' {...iconStyles.navigationArrow} onPress={() => props.goToCycleDay('after')} />
|
<NavigationArrow direction='right' {...props}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -8,19 +8,14 @@ import styles from '../../styles'
|
|||||||
import CycleDayHeader from './cycle-day'
|
import CycleDayHeader from './cycle-day'
|
||||||
import SymptomViewHeader from './symptom-view'
|
import SymptomViewHeader from './symptom-view'
|
||||||
|
|
||||||
export default function Header(props) {
|
export default function Header(p) {
|
||||||
const middle = Dimensions.get('window').width / 2
|
const middle = Dimensions.get('window').width / 2
|
||||||
|
const props = Object.assign({}, p, {middle})
|
||||||
return (
|
return (
|
||||||
props.isCycleDayOverView ?
|
props.isCycleDayOverView ?
|
||||||
<CycleDayHeader
|
<CycleDayHeader {...props} />
|
||||||
middle={middle}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
: props.isSymptomView ?
|
: props.isSymptomView ?
|
||||||
<SymptomViewHeader
|
<SymptomViewHeader {...props}/>
|
||||||
middle={middle}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
:
|
:
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<View style={styles.accentCircle} />
|
<View style={styles.accentCircle} />
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { TouchableOpacity } from 'react-native'
|
||||||
|
import styles, { iconStyles } from '../../styles'
|
||||||
|
import Icon from 'react-native-vector-icons/Entypo'
|
||||||
|
|
||||||
|
export default function NavigationArrow(props) {
|
||||||
|
const iconName = {
|
||||||
|
left: 'chevron-thin-left',
|
||||||
|
right: 'chevron-thin-right'
|
||||||
|
}[props.direction]
|
||||||
|
let pressHandler
|
||||||
|
if (props.goBack) {
|
||||||
|
pressHandler = () => props.goBack()
|
||||||
|
} else {
|
||||||
|
pressHandler = () => {
|
||||||
|
const target = props.direction === 'left' ? 'before' : 'after'
|
||||||
|
props.goToCycleDay(target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={styles.navigationArrow}
|
||||||
|
onPress={pressHandler}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
name={iconName}
|
||||||
|
{...iconStyles.navigationArrow}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -3,21 +3,19 @@ import {
|
|||||||
View,
|
View,
|
||||||
Text} from 'react-native'
|
Text} from 'react-native'
|
||||||
import styles, { iconStyles } from '../../styles'
|
import styles, { iconStyles } from '../../styles'
|
||||||
import Icon from 'react-native-vector-icons/Entypo'
|
|
||||||
import FeatherIcon from 'react-native-vector-icons/Feather'
|
import FeatherIcon from 'react-native-vector-icons/Feather'
|
||||||
|
import NavigationArrow from './navigation-arrow'
|
||||||
|
|
||||||
export default function SymptomViewHeader(props) {
|
export default function SymptomViewHeader(props) {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.header, styles.headerSymptom]}>
|
<View style={[styles.header, styles.headerCycleDay, styles.headerSymptom]}>
|
||||||
<View
|
<View
|
||||||
style={styles.accentCircle}
|
style={styles.accentCircle}
|
||||||
left={props.middle - styles.accentCircle.width / 2}
|
left={props.middle - styles.accentCircle.width / 2}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<NavigationArrow
|
||||||
name='chevron-thin-left'
|
direction='left'
|
||||||
{...iconStyles.navigationArrow}
|
{...props}
|
||||||
onPress={() => props.goBack()}
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.dateHeader}>
|
<Text style={styles.dateHeader}>
|
||||||
|
|||||||
+10
-13
@@ -191,11 +191,20 @@ export default StyleSheet.create({
|
|||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
paddingHorizontal: 15,
|
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
height: 80
|
height: 80
|
||||||
},
|
},
|
||||||
|
headerCycleDay: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
headerSymptom: {
|
||||||
|
paddingRight: 20
|
||||||
|
},
|
||||||
|
navigationArrow: {
|
||||||
|
padding: 20
|
||||||
|
},
|
||||||
menu: {
|
menu: {
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -215,18 +224,6 @@ export default StyleSheet.create({
|
|||||||
menuTextInActive: {
|
menuTextInActive: {
|
||||||
color: colorInActive
|
color: colorInActive
|
||||||
},
|
},
|
||||||
headerCycleDay: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
headerSymptom: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
navigationArrow: {
|
|
||||||
fontSize: 60,
|
|
||||||
color: fontOnPrimaryColor
|
|
||||||
},
|
|
||||||
temperatureTextInput: {
|
temperatureTextInput: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: 'black',
|
color: 'black',
|
||||||
|
|||||||
Reference in New Issue
Block a user