From 1898770fb00b731d6e8f577b1b5594558b1d6bcb Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Fri, 16 Nov 2018 15:07:59 +0100 Subject: [PATCH] Extract cycle day header --- components/header.js | 70 ---------------------------------- components/header/cycle-day.js | 28 ++++++++++++++ components/header/index.js | 50 ++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 70 deletions(-) delete mode 100644 components/header.js create mode 100644 components/header/cycle-day.js create mode 100644 components/header/index.js diff --git a/components/header.js b/components/header.js deleted file mode 100644 index 9ebbe58..0000000 --- a/components/header.js +++ /dev/null @@ -1,70 +0,0 @@ -import React, { Component } from 'react' -import { - View, - Text, - Dimensions -} from 'react-native' -import moment from 'moment' -import styles, { iconStyles } from '../styles' -import Icon from 'react-native-vector-icons/Entypo' -import FeatherIcon from 'react-native-vector-icons/Feather' - -export default class Header extends Component { - render() { - const middle = Dimensions.get('window').width / 2 - return ( - this.props.isCycleDayOverView ? - - - this.props.goToCycleDay('before')} - /> - - - {moment(this.props.date).format('MMMM Do YYYY')} - - {this.props.cycleDayNumber && - - Cycle day {this.props.cycleDayNumber} - } - - this.props.goToCycleDay('after')} - /> - - : this.props.isSymptomView ? - - - this.props.goBack()} - - /> - - - {this.props.title} - - - - - : - - - - {this.props.title} - - - ) - } -} \ No newline at end of file diff --git a/components/header/cycle-day.js b/components/header/cycle-day.js new file mode 100644 index 0000000..e7c5e13 --- /dev/null +++ b/components/header/cycle-day.js @@ -0,0 +1,28 @@ +import React from 'react' +import { + View, + Text} from 'react-native' +import moment from 'moment' +import styles, { iconStyles } from '../../styles' +import Icon from 'react-native-vector-icons/Entypo' + +export default function CycleDayHeader(props) { + return ( + + props.goToCycleDay('before')} /> + + + {moment(props.date).format('MMMM Do YYYY')} + + {props.cycleDayNumber && + + 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 new file mode 100644 index 0000000..0822c85 --- /dev/null +++ b/components/header/index.js @@ -0,0 +1,50 @@ +import React from 'react' +import { + View, + Text, + Dimensions +} 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 CycleDayHeader from './cycle-day' + +export default function Header(props) { + const middle = Dimensions.get('window').width / 2 + return ( + props.isCycleDayOverView ? + + : props.isSymptomView ? + + + props.goBack()} + + /> + + + {props.title} + + + + + : + + + + {props.title} + + + ) +} \ No newline at end of file