Merge branch 'feature/Add-symptom-icons-to-customization' into '676-feature-customisation-not-display-mucus-cervix'
Feature: Add symptom icons to customization toggles See merge request bloodyhealth/drip!666
This commit is contained in:
@@ -0,0 +1,63 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { Platform, StyleSheet, Switch, View } from 'react-native'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
|
import AppText from './app-text'
|
||||||
|
|
||||||
|
import DripIcon from '../../assets/drip-icons'
|
||||||
|
import { Colors, Containers, Sizes, Spacing } from '../../styles'
|
||||||
|
|
||||||
|
const TrackingCategorySwitch = ({ onToggle, symptom, text, value }) => {
|
||||||
|
const trackColor = { true: Colors.turquoiseDark }
|
||||||
|
const iconColor = value ? Colors.iconColors[symptom].color : Colors.grey
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<View style={styles.iconContainer}>
|
||||||
|
<DripIcon
|
||||||
|
color={iconColor}
|
||||||
|
name={`drip-icon-${symptom}`}
|
||||||
|
size={Sizes.title}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={styles.textContainer}>
|
||||||
|
<AppText>{text}</AppText>
|
||||||
|
</View>
|
||||||
|
<Switch
|
||||||
|
onValueChange={onToggle}
|
||||||
|
style={styles.appSwitch}
|
||||||
|
value={value}
|
||||||
|
trackColor={trackColor}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
TrackingCategorySwitch.propTypes = {
|
||||||
|
onToggle: PropTypes.func.isRequired,
|
||||||
|
symptom: PropTypes.string,
|
||||||
|
text: PropTypes.string,
|
||||||
|
value: PropTypes.bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
...Containers.rowContainer,
|
||||||
|
marginVertical: Spacing.tiny,
|
||||||
|
},
|
||||||
|
iconContainer: {
|
||||||
|
marginRight: Spacing.tiny,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
textContainer: {
|
||||||
|
flex: 5,
|
||||||
|
},
|
||||||
|
appSwitch: {
|
||||||
|
flex: 2,
|
||||||
|
transform:
|
||||||
|
Platform.OS === 'ios'
|
||||||
|
? [{ scaleX: 0.8 }, { scaleY: 0.8 }]
|
||||||
|
: [{ scaleX: 1 }, { scaleY: 1 }],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default TrackingCategorySwitch
|
||||||
@@ -7,6 +7,7 @@ import AppSwitch from '../../common/app-switch'
|
|||||||
import AppText from '../../common/app-text'
|
import AppText from '../../common/app-text'
|
||||||
import TemperatureSlider from './temperature-slider'
|
import TemperatureSlider from './temperature-slider'
|
||||||
import Segment from '../../common/segment'
|
import Segment from '../../common/segment'
|
||||||
|
import TrackingCategorySwitch from '../../common/tracking-category-switch'
|
||||||
import SelectTabGroup from '../../cycle-day/select-tab-group'
|
import SelectTabGroup from '../../cycle-day/select-tab-group'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -199,49 +200,57 @@ const Settings = () => {
|
|||||||
return (
|
return (
|
||||||
<AppPage title={labels.customization.title}>
|
<AppPage title={labels.customization.title}>
|
||||||
<Segment title={labels.customization.trackingCategories}>
|
<Segment title={labels.customization.trackingCategories}>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={temperatureTrackingCategoryToggle}
|
onToggle={temperatureTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[1])}
|
text={t(SYMPTOMS[1])}
|
||||||
value={isTemperatureTrackingCategoryEnabled}
|
value={isTemperatureTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[1]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={(enabled) => {
|
onToggle={(enabled) => {
|
||||||
mucusTrackingCategoryToggle(enabled)
|
mucusTrackingCategoryToggle(enabled)
|
||||||
}}
|
}}
|
||||||
text={t(SYMPTOMS[2])}
|
text={t(SYMPTOMS[2])}
|
||||||
value={isMucusTrackingCategoryEnabled}
|
value={isMucusTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[2]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={(enabled) => {
|
onToggle={(enabled) => {
|
||||||
cervixTrackingCategoryToggle(enabled)
|
cervixTrackingCategoryToggle(enabled)
|
||||||
}}
|
}}
|
||||||
text={t(SYMPTOMS[3])}
|
text={t(SYMPTOMS[3])}
|
||||||
value={isCervixTrackingCategoryEnabled}
|
value={isCervixTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[3]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={sexTrackingCategoryToggle}
|
onToggle={sexTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[4])}
|
text={t(SYMPTOMS[4])}
|
||||||
value={isSexTrackingCategoryEnabled}
|
value={isSexTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[4]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={desireTrackingCategoryToggle}
|
onToggle={desireTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[5])}
|
text={t(SYMPTOMS[5])}
|
||||||
value={isDesireTrackingCategoryEnabled}
|
value={isDesireTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[5]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={painTrackingCategoryToggle}
|
onToggle={painTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[6])}
|
text={t(SYMPTOMS[6])}
|
||||||
value={isPainTrackingCategoryEnabled}
|
value={isPainTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[6]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={moodTrackingCategoryToggle}
|
onToggle={moodTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[7])}
|
text={t(SYMPTOMS[7])}
|
||||||
value={isMoodTrackingCategoryEnabled}
|
value={isMoodTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[7]}
|
||||||
/>
|
/>
|
||||||
<AppSwitch
|
<TrackingCategorySwitch
|
||||||
onToggle={noteTrackingCategoryToggle}
|
onToggle={noteTrackingCategoryToggle}
|
||||||
text={t(SYMPTOMS[8])}
|
text={t(SYMPTOMS[8])}
|
||||||
value={isNoteTrackingCategoryEnabled}
|
value={isNoteTrackingCategoryEnabled}
|
||||||
|
symptom={SYMPTOMS[8]}
|
||||||
/>
|
/>
|
||||||
</Segment>
|
</Segment>
|
||||||
<Pressable onPress={sliderDisabledPrompt}>
|
<Pressable onPress={sliderDisabledPrompt}>
|
||||||
|
|||||||
+5
-1
@@ -18,6 +18,7 @@ const shadesOfPink = ['#c485a6', '#b15c89', pinkColor] // light to dark
|
|||||||
const lightGreenColor = '#bccd67'
|
const lightGreenColor = '#bccd67'
|
||||||
const orangeColor = '#bc6642'
|
const orangeColor = '#bc6642'
|
||||||
const mintColor = '#6ca299'
|
const mintColor = '#6ca299'
|
||||||
|
const turquoiseDark = '#69CBC1'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
greyDark: '#555',
|
greyDark: '#555',
|
||||||
@@ -27,7 +28,7 @@ export default {
|
|||||||
orange: '#F38337',
|
orange: '#F38337',
|
||||||
purple: '#3A2671',
|
purple: '#3A2671',
|
||||||
purpleLight: '#938EB2',
|
purpleLight: '#938EB2',
|
||||||
turquoiseDark: '#69CBC1',
|
turquoiseDark: turquoiseDark,
|
||||||
turquoise: '#CFECEA',
|
turquoise: '#CFECEA',
|
||||||
turquoiseLight: '#E9F2ED',
|
turquoiseLight: '#E9F2ED',
|
||||||
iconColors: {
|
iconColors: {
|
||||||
@@ -35,6 +36,9 @@ export default {
|
|||||||
color: redColor,
|
color: redColor,
|
||||||
shades: shadesOfRed,
|
shades: shadesOfRed,
|
||||||
},
|
},
|
||||||
|
temperature: {
|
||||||
|
color: turquoiseDark,
|
||||||
|
},
|
||||||
mucus: {
|
mucus: {
|
||||||
color: violetColor,
|
color: violetColor,
|
||||||
shades: shadesOfViolet,
|
shades: shadesOfViolet,
|
||||||
|
|||||||
Reference in New Issue
Block a user