Change font color of marked calendar days
This commit is contained in:
+10
-13
@@ -14,13 +14,13 @@ import {
|
|||||||
calendarTheme,
|
calendarTheme,
|
||||||
predictionToCalFormat,
|
predictionToCalFormat,
|
||||||
toCalFormat,
|
toCalFormat,
|
||||||
todayToCalFormat
|
todayToCalFormat,
|
||||||
} from './helpers/calendar'
|
} from './helpers/calendar'
|
||||||
|
|
||||||
class CalendarView extends Component {
|
class CalendarView extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
setDate: PropTypes.func.isRequired,
|
setDate: PropTypes.func.isRequired,
|
||||||
navigate: PropTypes.func.isRequired
|
navigate: PropTypes.func.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -30,7 +30,7 @@ class CalendarView extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
bleedingDaysInCalFormat: toCalFormat(this.bleedingDays),
|
bleedingDaysInCalFormat: toCalFormat(this.bleedingDays),
|
||||||
predictedBleedingDaysInCalFormat: predictionToCalFormat(predictedMenses),
|
predictedBleedingDaysInCalFormat: predictionToCalFormat(predictedMenses),
|
||||||
todayInCalFormat: todayToCalFormat()
|
todayInCalFormat: todayToCalFormat(),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bleedingDays.addListener(this.setStateWithCalFormattedDays)
|
this.bleedingDays.addListener(this.setStateWithCalFormattedDays)
|
||||||
@@ -42,7 +42,7 @@ class CalendarView extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
bleedingDaysInCalFormat: toCalFormat(this.bleedingDays),
|
bleedingDaysInCalFormat: toCalFormat(this.bleedingDays),
|
||||||
predictedBleedingDaysInCalFormat: predictionToCalFormat(predictedMenses),
|
predictedBleedingDaysInCalFormat: predictionToCalFormat(predictedMenses),
|
||||||
todayInCalFormat: todayToCalFormat()
|
todayInCalFormat: todayToCalFormat(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class CalendarView extends Component {
|
|||||||
const {
|
const {
|
||||||
todayInCalFormat,
|
todayInCalFormat,
|
||||||
bleedingDaysInCalFormat,
|
bleedingDaysInCalFormat,
|
||||||
predictedBleedingDaysInCalFormat
|
predictedBleedingDaysInCalFormat,
|
||||||
} = this.state
|
} = this.state
|
||||||
const markedDates = Object.assign(
|
const markedDates = Object.assign(
|
||||||
{},
|
{},
|
||||||
@@ -75,7 +75,7 @@ class CalendarView extends Component {
|
|||||||
firstDay={1}
|
firstDay={1}
|
||||||
onDayPress={this.passDateToDayView.bind(this)}
|
onDayPress={this.passDateToDayView.bind(this)}
|
||||||
markedDates={markedDates}
|
markedDates={markedDates}
|
||||||
markingType={'custom'}
|
markingType='custom'
|
||||||
theme={calendarTheme}
|
theme={calendarTheme}
|
||||||
// Max amount of months allowed to scroll to the past.
|
// Max amount of months allowed to scroll to the past.
|
||||||
pastScrollRange={120}
|
pastScrollRange={120}
|
||||||
@@ -86,17 +86,14 @@ class CalendarView extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: { flex: 1 }
|
container: { flex: 1 },
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return({
|
return {
|
||||||
setDate: (date) => dispatch(setDate(date)),
|
setDate: (date) => dispatch(setDate(date)),
|
||||||
navigate: (page) => dispatch(navigate(page)),
|
navigate: (page) => dispatch(navigate(page)),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(null, mapDispatchToProps)(CalendarView)
|
||||||
null,
|
|
||||||
mapDispatchToProps,
|
|
||||||
)(CalendarView)
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
loadingContainer: {
|
loadingContainer: {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
backgroundColor: Colors.tourquiseLight,
|
backgroundColor: Colors.turquoiseLight,
|
||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ export default class DotAndLine extends Component {
|
|||||||
const dot = new Path().moveTo(CHART_COLUMN_MIDDLE , y - CHART_DOT_RADIUS)
|
const dot = new Path().moveTo(CHART_COLUMN_MIDDLE , y - CHART_DOT_RADIUS)
|
||||||
.arc(0, CHART_DOT_RADIUS * 2, CHART_DOT_RADIUS)
|
.arc(0, CHART_DOT_RADIUS * 2, CHART_DOT_RADIUS)
|
||||||
.arc(0, CHART_DOT_RADIUS * -2, CHART_DOT_RADIUS)
|
.arc(0, CHART_DOT_RADIUS * -2, CHART_DOT_RADIUS)
|
||||||
const dotColor = exclude ? Colors.tourquise : Colors.tourquiseDark
|
const dotColor = exclude ? Colors.turquoise : Colors.turquoiseDark
|
||||||
const lineColorLeft = excludeLeftLine ?
|
const lineColorLeft = excludeLeftLine ?
|
||||||
Colors.tourquise : Colors.tourquiseDark
|
Colors.turquoise : Colors.turquoiseDark
|
||||||
const lineColorRight = excludeRightLine ?
|
const lineColorRight = excludeRightLine ?
|
||||||
Colors.tourquise : Colors.tourquiseDark
|
Colors.turquoise : Colors.turquoiseDark
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ AppPage.propTypes = {
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
backgroundColor: Colors.tourquiseLight,
|
backgroundColor: Colors.turquoiseLight,
|
||||||
flex: 1
|
flex: 1
|
||||||
},
|
},
|
||||||
scrollView: {
|
scrollView: {
|
||||||
backgroundColor: Colors.tourquiseLight,
|
backgroundColor: Colors.turquoiseLight,
|
||||||
flexGrow: 1
|
flexGrow: 1
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Logo.propTypes = {
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
logo: {
|
logo: {
|
||||||
color: Colors.tourquiseDark,
|
color: Colors.turquoiseDark,
|
||||||
fontFamily: Fonts.bold,
|
fontFamily: Fonts.bold,
|
||||||
fontSize: Sizes.title
|
fontSize: Sizes.title
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,13 @@ export const toCalFormat = (bleedingDaysSortedByDate) => {
|
|||||||
customStyles: {
|
customStyles: {
|
||||||
container: {
|
container: {
|
||||||
backgroundColor: shades[day.bleeding.value],
|
backgroundColor: shades[day.bleeding.value],
|
||||||
}
|
paddingTop: 2,
|
||||||
}
|
},
|
||||||
}
|
text: {
|
||||||
if (day.date === todayDateString) {
|
color: Colors.turquoiseLight,
|
||||||
acc[day.date].customStyles.text = styles.calendarToday
|
...(day.date === todayDateString && styles.calendarToday),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
@@ -31,12 +33,11 @@ export const predictionToCalFormat = (predictedDays) => {
|
|||||||
accSet[day] = {
|
accSet[day] = {
|
||||||
customStyles: {
|
customStyles: {
|
||||||
container: {
|
container: {
|
||||||
borderColor: (i === middleIndex) ? shades[3] : shades[0],
|
borderColor: i === middleIndex ? shades[3] : shades[0],
|
||||||
borderStyle: (i === middleIndex) ? 'solid' : 'dashed',
|
borderStyle: i === middleIndex ? 'solid' : 'dashed',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (day === todayDateString) {
|
if (day === todayDateString) {
|
||||||
accSet[day].customStyles.text = styles.calendarToday
|
accSet[day].customStyles.text = styles.calendarToday
|
||||||
@@ -50,24 +51,24 @@ export const predictionToCalFormat = (predictedDays) => {
|
|||||||
|
|
||||||
export const todayToCalFormat = () => {
|
export const todayToCalFormat = () => {
|
||||||
const todayDateString = LocalDate.now().toString()
|
const todayDateString = LocalDate.now().toString()
|
||||||
const todayFormated = {}
|
return {
|
||||||
todayFormated[todayDateString] = {
|
[todayDateString]: {
|
||||||
customStyles: {
|
customStyles: {
|
||||||
text: styles.calendarToday
|
text: styles.calendarToday,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return todayFormated
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
calendarToday: {
|
calendarToday: {
|
||||||
fontFamily: Fonts.bold,
|
fontFamily: Fonts.bold,
|
||||||
color: Colors.purple
|
color: Colors.purple,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export const calendarTheme = {
|
export const calendarTheme = {
|
||||||
calendarBackground: Colors.tourquiseLight,
|
calendarBackground: Colors.turquoiseLight,
|
||||||
dayTextColor: Colors.greyDark,
|
dayTextColor: Colors.greyDark,
|
||||||
monthTextColor: Colors.purple,
|
monthTextColor: Colors.purple,
|
||||||
textDayFontFamily: Fonts.main,
|
textDayFontFamily: Fonts.main,
|
||||||
|
|||||||
+6
-6
@@ -77,21 +77,21 @@ class Home extends Component {
|
|||||||
{cycleDayNumber &&
|
{cycleDayNumber &&
|
||||||
<View style={styles.line}>
|
<View style={styles.line}>
|
||||||
<AppText style={styles.whiteSubtitle}>{cycleDayText}</AppText>
|
<AppText style={styles.whiteSubtitle}>{cycleDayText}</AppText>
|
||||||
<AppText style={styles.tourquiseText}>{labels.cycleDay}</AppText>
|
<AppText style={styles.turquoiseText}>{labels.cycleDay}</AppText>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
{phase &&
|
{phase &&
|
||||||
<View style={styles.line}>
|
<View style={styles.line}>
|
||||||
<AppText style={styles.whiteSubtitle}>{phaseText}</AppText>
|
<AppText style={styles.whiteSubtitle}>{phaseText}</AppText>
|
||||||
<AppText style={styles.tourquiseText}>
|
<AppText style={styles.turquoiseText}>
|
||||||
{labels.cyclePhase}
|
{labels.cyclePhase}
|
||||||
</AppText>
|
</AppText>
|
||||||
<AppText style={styles.tourquiseText}>{status}</AppText>
|
<AppText style={styles.turquoiseText}>{status}</AppText>
|
||||||
<Asterisk />
|
<Asterisk />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
<View style={styles.line}>
|
<View style={styles.line}>
|
||||||
<AppText style={styles.tourquiseText}>{prediction}</AppText>
|
<AppText style={styles.turquoiseText}>{prediction}</AppText>
|
||||||
</View>
|
</View>
|
||||||
<Button isCTA isSmall={false} onPress={this.navigateToCycleDayView}>
|
<Button isCTA isSmall={false} onPress={this.navigateToCycleDayView}>
|
||||||
{labels.addData}
|
{labels.addData}
|
||||||
@@ -137,8 +137,8 @@ const styles = StyleSheet.create({
|
|||||||
fontSize: Sizes.huge,
|
fontSize: Sizes.huge,
|
||||||
marginVertical: Spacing.base,
|
marginVertical: Spacing.base,
|
||||||
},
|
},
|
||||||
tourquiseText: {
|
turquoiseText: {
|
||||||
color: Colors.tourquise,
|
color: Colors.turquoise,
|
||||||
fontSize: Sizes.subtitle,
|
fontSize: Sizes.subtitle,
|
||||||
},
|
},
|
||||||
whiteSubtitle: {
|
whiteSubtitle: {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const styles = StyleSheet.create({
|
|||||||
paddingTop: Sizes.base
|
paddingTop: Sizes.base
|
||||||
},
|
},
|
||||||
marker: {
|
marker: {
|
||||||
backgroundColor: Colors.tourquiseDark,
|
backgroundColor: Colors.turquoiseDark,
|
||||||
borderRadius: 50,
|
borderRadius: 50,
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
height: Sizes.subtitle,
|
height: Sizes.subtitle,
|
||||||
@@ -72,9 +72,9 @@ const styles = StyleSheet.create({
|
|||||||
height: Sizes.small
|
height: Sizes.small
|
||||||
},
|
},
|
||||||
sliderAccentBackground: {
|
sliderAccentBackground: {
|
||||||
backgroundColor: Colors.tourquiseDark
|
backgroundColor: Colors.turquoiseDark
|
||||||
},
|
},
|
||||||
sliderBackground: {
|
sliderBackground: {
|
||||||
backgroundColor: Colors.tourquise
|
backgroundColor: Colors.turquoise
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
+3
-3
@@ -19,9 +19,9 @@ export default {
|
|||||||
orange: '#F38337',
|
orange: '#F38337',
|
||||||
purple: '#3A2671',
|
purple: '#3A2671',
|
||||||
purpleLight: '#938EB2',
|
purpleLight: '#938EB2',
|
||||||
tourquiseDark: '#69CBC1',
|
turquoiseDark: '#69CBC1',
|
||||||
tourquise: '#CFECEA',
|
turquoise: '#CFECEA',
|
||||||
tourquiseLight: '#E9F2ED',
|
turquoiseLight: '#E9F2ED',
|
||||||
iconColors: {
|
iconColors: {
|
||||||
'bleeding': {
|
'bleeding': {
|
||||||
color: redColor,
|
color: redColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user