diff --git a/components/header/cycle-day.js b/components/header/cycle-day.js index e7c5e13..a78cf1b 100644 --- a/components/header/cycle-day.js +++ b/components/header/cycle-day.js @@ -3,8 +3,8 @@ import { View, Text} from 'react-native' import moment from 'moment' -import styles, { iconStyles } from '../../styles' -import Icon from 'react-native-vector-icons/Entypo' +import styles from '../../styles' +import NavigationArrow from './navigation-arrow' export default function CycleDayHeader(props) { return ( @@ -12,7 +12,7 @@ export default function CycleDayHeader(props) { style={styles.accentCircle} left={props.middle - styles.accentCircle.width / 2} /> - props.goToCycleDay('before')} /> + {moment(props.date).format('MMMM Do YYYY')} @@ -22,7 +22,7 @@ export default function CycleDayHeader(props) { Cycle day {props.cycleDayNumber} } - props.goToCycleDay('after')} /> + ) } \ No newline at end of file diff --git a/components/header/index.js b/components/header/index.js index afec4aa..c935f6e 100644 --- a/components/header/index.js +++ b/components/header/index.js @@ -8,19 +8,14 @@ import styles from '../../styles' import CycleDayHeader from './cycle-day' import SymptomViewHeader from './symptom-view' -export default function Header(props) { +export default function Header(p) { const middle = Dimensions.get('window').width / 2 + const props = Object.assign({}, p, {middle}) return ( props.isCycleDayOverView ? - + : props.isSymptomView ? - + : diff --git a/components/header/navigation-arrow.js b/components/header/navigation-arrow.js new file mode 100644 index 0000000..6a7b95b --- /dev/null +++ b/components/header/navigation-arrow.js @@ -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 ( + + + + ) +} \ No newline at end of file diff --git a/components/header/symptom-view.js b/components/header/symptom-view.js index 85d2262..df8b4be 100644 --- a/components/header/symptom-view.js +++ b/components/header/symptom-view.js @@ -3,21 +3,19 @@ import { View, Text} from 'react-native' import styles, { iconStyles } from '../../styles' -import Icon from 'react-native-vector-icons/Entypo' import FeatherIcon from 'react-native-vector-icons/Feather' +import NavigationArrow from './navigation-arrow' export default function SymptomViewHeader(props) { return ( - + - props.goBack()} - + diff --git a/styles/index.js b/styles/index.js index 31e62f7..9c3b016 100644 --- a/styles/index.js +++ b/styles/index.js @@ -191,11 +191,20 @@ export default StyleSheet.create({ }, header: { backgroundColor: primaryColor, - paddingHorizontal: 15, alignItems: 'center', justifyContent: 'center', height: 80 }, + headerCycleDay: { + flexDirection: 'row', + justifyContent: 'space-between', + }, + headerSymptom: { + paddingRight: 20 + }, + navigationArrow: { + padding: 20 + }, menu: { backgroundColor: primaryColor, alignItems: 'center', @@ -215,18 +224,6 @@ export default StyleSheet.create({ menuTextInActive: { color: colorInActive }, - headerCycleDay: { - flexDirection: 'row', - justifyContent: 'space-between', - }, - headerSymptom: { - flexDirection: 'row', - justifyContent: 'space-between', - }, - navigationArrow: { - fontSize: 60, - color: fontOnPrimaryColor - }, temperatureTextInput: { fontSize: 20, color: 'black',