diff --git a/components/common/tracking-category-switch.js b/components/common/tracking-category-switch.js new file mode 100644 index 0000000..aef5824 --- /dev/null +++ b/components/common/tracking-category-switch.js @@ -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 ( + + + + + + {text} + + + + ) +} + +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 diff --git a/components/settings/customization/index.js b/components/settings/customization/index.js index 1d6cc3f..6b236a5 100644 --- a/components/settings/customization/index.js +++ b/components/settings/customization/index.js @@ -7,6 +7,7 @@ import AppSwitch from '../../common/app-switch' import AppText from '../../common/app-text' import TemperatureSlider from './temperature-slider' import Segment from '../../common/segment' +import TrackingCategorySwitch from '../../common/tracking-category-switch' import SelectTabGroup from '../../cycle-day/select-tab-group' import { @@ -199,49 +200,57 @@ const Settings = () => { return ( - - { mucusTrackingCategoryToggle(enabled) }} text={t(SYMPTOMS[2])} value={isMucusTrackingCategoryEnabled} + symptom={SYMPTOMS[2]} /> - { cervixTrackingCategoryToggle(enabled) }} text={t(SYMPTOMS[3])} value={isCervixTrackingCategoryEnabled} + symptom={SYMPTOMS[3]} /> - - - - - diff --git a/styles/colors.js b/styles/colors.js index f091d02..7baf8cd 100644 --- a/styles/colors.js +++ b/styles/colors.js @@ -18,6 +18,7 @@ const shadesOfPink = ['#c485a6', '#b15c89', pinkColor] // light to dark const lightGreenColor = '#bccd67' const orangeColor = '#bc6642' const mintColor = '#6ca299' +const turquoiseDark = '#69CBC1' export default { greyDark: '#555', @@ -27,7 +28,7 @@ export default { orange: '#F38337', purple: '#3A2671', purpleLight: '#938EB2', - turquoiseDark: '#69CBC1', + turquoiseDark: turquoiseDark, turquoise: '#CFECEA', turquoiseLight: '#E9F2ED', iconColors: { @@ -35,6 +36,9 @@ export default { color: redColor, shades: shadesOfRed, }, + temperature: { + color: turquoiseDark, + }, mucus: { color: violetColor, shades: shadesOfViolet,