Rafactors symptom color definition

This commit is contained in:
mashazyu
2019-11-17 17:15:56 +01:00
committed by Sofiya Tepikin
parent 02ca733147
commit 34a0e15e66
3 changed files with 53 additions and 47 deletions
+4 -3
View File
@@ -146,16 +146,17 @@ class DayColumn extends Component {
const styleParent = [styles.symptomRow, {height: symptomHeight}] const styleParent = [styles.symptomRow, {height: symptomHeight}]
if (shouldDrawSymptom) { if (shouldDrawSymptom) {
const styleSymptom = styles.iconShades[symptom] const styleSymptom = styles.iconColors[symptom]
const symptomData = this.data[symptom] const symptomData = this.data[symptom]
const symptomColor = styleSymptom.shades[symptomData]
const dataIsComplete = this.isSymptomDataComplete(symptom) const dataIsComplete = this.isSymptomDataComplete(symptom)
const isMucusOrCervix = (symptom === 'mucus') || (symptom === 'cervix') const isMucusOrCervix = (symptom === 'mucus') || (symptom === 'cervix')
const backgroundColor = (isMucusOrCervix && !dataIsComplete) ? const backgroundColor = (isMucusOrCervix && !dataIsComplete) ?
'white' : styleSymptom[symptomData] 'white' : symptomColor
const borderWidth = (isMucusOrCervix && !dataIsComplete) ? 2 : 0 const borderWidth = (isMucusOrCervix && !dataIsComplete) ? 2 : 0
const borderColor = styleSymptom[0] const borderColor = symptomColor
const styleChild = [styles.symptomIcon, { const styleChild = [styles.symptomIcon, {
backgroundColor, backgroundColor,
borderColor, borderColor,
+46 -28
View File
@@ -11,6 +11,19 @@ const gridLineWidthVertical = 0.6
const gridLineWidthHorizontal = 0.3 const gridLineWidthHorizontal = 0.3
const numberLabelFontSize = 13 const numberLabelFontSize = 13
const redColor = '#c3000d'
const violetColor = '#7689a9'
const shadesOfViolet = ['#e3e7ed', '#c8cfdc', '#acb8cb', '#91a0ba', violetColor] // light to dark
const yellowColor = '#dbb40c'
const shadesOfYellow = ['#f0e19d', '#e9d26d', '#e2c33c', yellowColor] // light to dark
const magentaColor = '#6f2565'
const shadesOfMagenta = ['#a87ca2', '#8b5083', magentaColor] // light to dark
const pinkColor = '#9e346c'
const shadesOfPink = ['#c485a6', '#b15c89', pinkColor] // light to dark
const lightGreenColor = '#bccd67'
const orangeColor = '#bc6642'
const mintColor = '#6ca299'
const styles = { const styles = {
curve: { curve: {
stroke: colorTemperature, stroke: colorTemperature,
@@ -53,34 +66,39 @@ const styles = {
height: 12, height: 12,
borderRadius: 50, borderRadius: 50,
}, },
iconShades: { iconColors: {
'bleeding': shadesOfRed, 'bleeding': {
'mucus': [ color: redColor,
'#e3e7ed', shades: shadesOfRed,
'#c8cfdc', },
'#acb8cb', 'mucus': {
'#91a0ba', color: violetColor,
'#7689a9' shades: shadesOfViolet,
], },
'cervix': [ 'cervix': {
'#f0e19d', color: yellowColor,
'#e9d26d', shades: shadesOfYellow,
'#e2c33c', },
'#dbb40c', 'sex': {
], color: magentaColor,
'sex': [ shades: shadesOfMagenta,
'#a87ca2', },
'#8b5083', 'desire': {
'#6f2565', color: pinkColor,
], shades: shadesOfPink,
'desire': [ },
'#c485a6', 'pain': {
'#b15c89', color: lightGreenColor,
'#9e346c', shades: [lightGreenColor],
], },
'pain': ['#bccd67'], 'mood': {
'mood': ['#bc6642'], color: orangeColor,
'note': ['#6ca299'] shades: [orangeColor],
},
'note': {
color: mintColor,
shades: [mintColor],
},
}, },
yAxis: { yAxis: {
width: 27, width: 27,
+3 -16
View File
@@ -14,19 +14,6 @@ import { cycleDayColor } from '../../styles'
import { shared as labels } from '../../i18n/en/labels' import { shared as labels } from '../../i18n/en/labels'
const symptomIcons = {
bleeding: <DripIcon size={16} name='drip-icon-bleeding' color={styles.iconShades.bleeding[3]}/>,
mucus: <DripIcon size={16} name='drip-icon-mucus' color={styles.iconShades.mucus[4]}/>,
cervix: <DripIcon size={16} name='drip-icon-cervix' color={styles.iconShades.cervix[3]}/>,
desire: <DripIcon size={16} name='drip-icon-desire' color={styles.iconShades.desire[2]}/>,
sex: <DripIcon size={16} name='drip-icon-sex' color={styles.iconShades.sex[2]}/>,
pain: <DripIcon size={16} name='drip-icon-pain' color={styles.iconShades.pain[0]}/>,
mood: <DripIcon size={16} name='drip-icon-mood' color={styles.iconShades.mood[0]}/>,
note: <DripIcon size={16} name='drip-icon-note' color={styles.iconShades.note[0]}/>
}
export function makeYAxisLabels(columnHeight) { export function makeYAxisLabels(columnHeight) {
const units = unitObservable.value const units = unitObservable.value
const scaleMax = scaleObservable.value.max const scaleMax = scaleObservable.value.max
@@ -100,14 +87,14 @@ const YAxis = ({ height, symptomsToDisplay, symptomsSectionHeight }) => {
return ( return (
<View> <View>
<View style={[styles.yAxis, {height: symptomsSectionHeight}]}> <View style={[styles.yAxis, {height: symptomsSectionHeight}]}>
{symptomsToDisplay.map(symptomName => { {symptomsToDisplay.map(symptom => {
return <View return <View
style={{ alignItems: 'center', justifyContent: 'center' }} style={{ alignItems: 'center', justifyContent: 'center' }}
key={symptomName} key={symptom}
width={styles.yAxis.width} width={styles.yAxis.width}
height={symptomsSectionHeight / symptomsToDisplay.length} height={symptomsSectionHeight / symptomsToDisplay.length}
> >
{symptomIcons[symptomName]} <DripIcon size={16} name={`drip-icon-${symptom}`} color={styles.iconColors[symptom].color}/>
</View> </View>
})} })}
</View> </View>