Prettify chart files

This commit is contained in:
Sofiya Tepikin
2022-08-23 12:52:38 +02:00
parent f72994082c
commit 732f19ed63
8 changed files with 67 additions and 73 deletions
+14 -17
View File
@@ -6,7 +6,7 @@ import { Colors, Containers } from '../../styles'
import {
CHART_COLUMN_WIDTH,
CHART_DOT_RADIUS,
CHART_GRID_LINE_HORIZONTAL_WIDTH
CHART_GRID_LINE_HORIZONTAL_WIDTH,
} from '../../config'
const SymptomCell = ({
@@ -14,22 +14,22 @@ const SymptomCell = ({
index,
symptom,
symptomValue,
isSymptomDataComplete
isSymptomDataComplete,
}) => {
const shouldDrawDot = symptomValue !== false
const styleCell = index !== 0
? [styles.cell, { height, width: CHART_COLUMN_WIDTH }]
: [styles.cell, { height, width: CHART_COLUMN_WIDTH }, styles.topBorder]
const styleCell =
index !== 0
? [styles.cell, { height, width: CHART_COLUMN_WIDTH }]
: [styles.cell, { height, width: CHART_COLUMN_WIDTH }, styles.topBorder]
let styleDot
if (shouldDrawDot) {
const styleSymptom = Colors.iconColors[symptom]
const symptomColor = styleSymptom.shades[symptomValue]
const isMucusOrCervix = (symptom === 'mucus') || (symptom === 'cervix')
const backgroundColor = (isMucusOrCervix && !isSymptomDataComplete) ?
'white' : symptomColor
const borderWidth = (isMucusOrCervix && !isSymptomDataComplete) ? 2 : 0
const isMucusOrCervix = symptom === 'mucus' || symptom === 'cervix'
const backgroundColor =
isMucusOrCervix && !isSymptomDataComplete ? 'white' : symptomColor
const borderWidth = isMucusOrCervix && !isSymptomDataComplete ? 2 : 0
const borderColor = symptomColor
styleDot = [styles.dot, { backgroundColor, borderColor, borderWidth }]
}
@@ -45,10 +45,7 @@ SymptomCell.propTypes = {
height: PropTypes.number,
index: PropTypes.number.isRequired,
symptom: PropTypes.string,
symptomValue: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.number,
]),
symptomValue: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
isSymptomDataComplete: PropTypes.bool,
}
@@ -59,7 +56,7 @@ const styles = StyleSheet.create({
borderBottomWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
borderLeftColor: Colors.grey,
borderLeftWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
...Containers.centerItems
...Containers.centerItems,
},
topBorder: {
borderTopColor: Colors.grey,
@@ -68,7 +65,7 @@ const styles = StyleSheet.create({
dot: {
width: CHART_DOT_RADIUS * 2,
height: CHART_DOT_RADIUS * 2,
borderRadius: 50
}
borderRadius: 50,
},
})
export default SymptomCell