diff --git a/components/chart/day-column.js b/components/chart/day-column.js index 97a4f1491efa82b2a417cadcedaf7a4310ff5466..541377da668f1e882ecbe8b60b586f9eb18bcc97 100644 --- a/components/chart/day-column.js +++ b/components/chart/day-column.js @@ -157,7 +157,7 @@ class DayColumn extends Component { 'white' : symptomColor const borderWidth = (isMucusOrCervix && !dataIsComplete) ? 2 : 0 const borderColor = symptomColor - const styleChild = [styles.symptomIcon, { + const styleChild = [styles.symptomDot, { backgroundColor, borderColor, borderWidth diff --git a/components/chart/styles.js b/components/chart/styles.js index 9a17f6fa6b0c1a9a1b11073df43ad8be4059b851..d95f51d0e1bb5101ddbe8e68f748c4253b92b00e 100644 --- a/components/chart/styles.js +++ b/components/chart/styles.js @@ -61,7 +61,7 @@ const styles = { width: gridLineWidthVertical, } }, - symptomIcon: { + symptomDot: { width: 12, height: 12, borderRadius: 50, @@ -127,6 +127,10 @@ const styles = { fontWeight: '100', } }, + symptomIcon: { + alignItems: 'center', + justifyContent: 'center', + }, horizontalGrid: { position:'absolute', borderStyle: 'solid', diff --git a/components/chart/symptom-icon.js b/components/chart/symptom-icon.js new file mode 100644 index 0000000000000000000000000000000000000000..3236c3b044009c998bff77c8f065beb769aa20e2 --- /dev/null +++ b/components/chart/symptom-icon.js @@ -0,0 +1,26 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { View } from 'react-native' + +import DripIcon from '../../assets/drip-icons' + +import styles from './styles' + +const SymptomIcon = ({ symptom, height }) => { + return ( + <View style={styles.symptomIcon} width={styles.yAxis.width} height={height}> + <DripIcon + size={16} + name={`drip-icon-${symptom}`} + color={styles.iconColors[symptom].color} + /> + </View> + ) +} + +SymptomIcon.propTypes = { + height: PropTypes.number, + symptom: PropTypes.string, +} + +export default SymptomIcon diff --git a/components/chart/y-axis.js b/components/chart/y-axis.js index d2bed28a8f7e3d3e7948adbe1a6d8232d8684ba5..54025702da48ea6cdbbbe7fbcb0eb7b9578e2f39 100644 --- a/components/chart/y-axis.js +++ b/components/chart/y-axis.js @@ -6,8 +6,8 @@ import config from '../../config' import { scaleObservable, unitObservable } from '../../local-storage' import AppText from '../app-text' -import DripIcon from '../../assets/drip-icons' import DripHomeIcon from '../../assets/drip-home-icons' +import SymptomIcon from './symptom-icon' import styles from './styles' import { cycleDayColor } from '../../styles' @@ -84,18 +84,18 @@ function getAbsoluteValue(relative, columnHeight) { } const YAxis = ({ height, symptomsToDisplay, symptomsSectionHeight }) => { + const symptomIconHeight = symptomsSectionHeight / symptomsToDisplay.length return ( <View> <View style={[styles.yAxis, {height: symptomsSectionHeight}]}> {symptomsToDisplay.map(symptom => { - return <View - style={{ alignItems: 'center', justifyContent: 'center' }} - key={symptom} - width={styles.yAxis.width} - height={symptomsSectionHeight / symptomsToDisplay.length} - > - <DripIcon size={16} name={`drip-icon-${symptom}`} color={styles.iconColors[symptom].color}/> - </View> + return ( + <SymptomIcon + key={symptom} + symptom={symptom} + height={symptomIconHeight} + /> + ) })} </View> <View style={[styles.yAxis, { height }]}>{makeYAxisLabels(height)}</View>