Merge branch 'today-overview-header' into 'master'
Changes header of today's cycle day overview page Closes #216 See merge request bloodyhealth/drip!122
This commit is contained in:
@@ -2,11 +2,18 @@ import React from 'react'
|
||||
import {
|
||||
View,
|
||||
Text} from 'react-native'
|
||||
import { LocalDate } from 'js-joda'
|
||||
import moment from 'moment'
|
||||
import styles from '../../styles'
|
||||
import NavigationArrow from './navigation-arrow'
|
||||
|
||||
export default function CycleDayHeader(props) {
|
||||
const FormattedDate = ({ date }) => {
|
||||
const today = LocalDate.now()
|
||||
const dateToDisplay = LocalDate.parse(date)
|
||||
return today.equals(dateToDisplay) ? 'today' : moment(date).format('MMMM Do YYYY')
|
||||
}
|
||||
|
||||
export default function CycleDayHeader({ date, ...props }) {
|
||||
return (<View style={[styles.header, styles.headerCycleDay]}>
|
||||
<View
|
||||
style={styles.accentCircle}
|
||||
@@ -15,7 +22,7 @@ export default function CycleDayHeader(props) {
|
||||
<NavigationArrow direction='left' {...props}/>
|
||||
<View>
|
||||
<Text style={styles.dateHeader}>
|
||||
{moment(props.date).format('MMMM Do YYYY')}
|
||||
<FormattedDate date={date} />
|
||||
</Text>
|
||||
{props.cycleDayNumber &&
|
||||
<Text style={styles.cycleDayNumber}>
|
||||
|
||||
Reference in New Issue
Block a user