From f444de0b8796b002fee96134b925f805ec34c7a7 Mon Sep 17 00:00:00 2001
From: Sofiya Tepikin <sofiya.tepikin@gmail.com>
Date: Sun, 15 Sep 2019 15:29:15 +0200
Subject: [PATCH] Removes the lowercasing to the header title component

---
 components/app.js                             |  9 +--------
 components/cycle-day/cycle-day-overview.js    |  3 +--
 components/cycle-day/symptoms/symptom-view.js |  2 +-
 components/header/title.js                    | 12 +++++++++---
 components/helpers/format-date.js             |  5 +++--
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/components/app.js b/components/app.js
index 1d0151dd..cef888e0 100644
--- a/components/app.js
+++ b/components/app.js
@@ -18,13 +18,6 @@ import {headerTitles, menuTitles} from '../i18n/en/labels'
 import setupNotifications from '../lib/notifications'
 import { closeDb } from '../db'
 
-// design wants everyhting lowercased, but we don't
-// have CSS pseudo properties
-const headerTitlesLowerCase = Object.keys(headerTitles).reduce((acc, curr) => {
-  acc[curr] = headerTitles[curr].toLowerCase()
-  return acc
-}, {})
-
 const HOME_PAGE = 'Home'
 const CYCLE_DAY_PAGE = 'CycleDay'
 const SETTINGS_MENU_PAGE = 'SettingsMenu'
@@ -107,7 +100,7 @@ class App extends Component {
       ...symptomViews
     }
     const Page = pages[currentPage]
-    const title = headerTitlesLowerCase[currentPage]
+    const title = headerTitles[currentPage]
 
     const hasDefaultHeader =
       !this.isSymptomView() &&
diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js
index 5a393062..4df2f283 100644
--- a/components/cycle-day/cycle-day-overview.js
+++ b/components/cycle-day/cycle-day-overview.js
@@ -66,8 +66,7 @@ class CycleDayOverView extends Component {
 
     const { getCycleDayNumber } = cycleModule()
     const cycleDayNumber = getCycleDayNumber(date)
-    const headerSubtitle =
-      cycleDayNumber && `Cycle day ${cycleDayNumber}`.toLowerCase()
+    const headerSubtitle = cycleDayNumber && `Cycle day ${cycleDayNumber}`
 
     return (
       <View style={{ flex: 1 }}>
diff --git a/components/cycle-day/symptoms/symptom-view.js b/components/cycle-day/symptoms/symptom-view.js
index 749a8736..d192f67d 100644
--- a/components/cycle-day/symptoms/symptom-view.js
+++ b/components/cycle-day/symptoms/symptom-view.js
@@ -106,7 +106,7 @@ class SymptomView extends Component {
     return (
       <View style={{flex: 1}}>
         <Header
-          title={headerTitles[symptom].toLowerCase()}
+          title={headerTitles[symptom]}
           subtitle={formatDate(this.date)}
           handleBack={this.props.handleBackButtonPress}
           handleDelete={
diff --git a/components/header/title.js b/components/header/title.js
index eb5c8baf..f667ded2 100644
--- a/components/header/title.js
+++ b/components/header/title.js
@@ -10,18 +10,24 @@ export default function Title({ title, subtitle }) {
     return (
       <View>
         <Text style={styles.dateHeader} testID='headerTitle'>
-          {title}
+          { // design wants everyhting lowercased, but we don't
+            // have CSS pseudo properties
+            title.toLowerCase()}
         </Text>
         { subtitle &&
           <Text style={styles.cycleDayNumber} testID='headerSubtitle'>
-            {subtitle}
+            {subtitle.toLowerCase()}
           </Text>
         }
       </View>
     )
   }
 
-  return <Text testID='headerTitle' style={styles.headerText}>{title}</Text>
+  return (
+    <Text testID='headerTitle' style={styles.headerText}>
+      {title.toLowerCase()}
+    </Text>
+  )
 }
 
 Title.propTypes = {
diff --git a/components/helpers/format-date.js b/components/helpers/format-date.js
index cf63f70c..d353dc64 100644
--- a/components/helpers/format-date.js
+++ b/components/helpers/format-date.js
@@ -4,8 +4,9 @@ import moment from 'moment'
 export default function (date) {
   const today = LocalDate.now()
   const dateToDisplay = LocalDate.parse(date)
-  const formattedDate = today.equals(dateToDisplay) ? 'today' : moment(date).format('MMMM Do YYYY')
-  return formattedDate.toLowerCase()
+  return today.equals(dateToDisplay) ?
+    'today' :
+    moment(date).format('MMMM Do YYYY')
 }
 
 export function formatDateForShortText (date) {
-- 
GitLab