diff --git a/components/cycle-day/select-box.js b/components/cycle-day/select-box.js new file mode 100644 index 0000000..ec4520c --- /dev/null +++ b/components/cycle-day/select-box.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react' +import { + View, + Text, + TouchableOpacity, +} from 'react-native' +import styles from '../../styles' + +export default class SelectBox extends Component { + render () { + const style = [styles.selectBox] + const textStyle = [] + if (this.props.value) { + style.push(styles.selectBoxActive) + textStyle.push(styles.selectBoxTextActive) + } + return ( + + + {this.props.label} + + + ) + } +} \ No newline at end of file diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js index bd24b9e..8ccba47 100644 --- a/components/cycle-day/symptoms/bleeding.js +++ b/components/cycle-day/symptoms/bleeding.js @@ -35,7 +35,7 @@ export default class Bleeding extends Component { ] return ( - + - Exclude + Exclude { this.setState({ exclude: val }) diff --git a/components/cycle-day/symptoms/cervix.js b/components/cycle-day/symptoms/cervix.js index d1d8ba6..96d332b 100644 --- a/components/cycle-day/symptoms/cervix.js +++ b/components/cycle-day/symptoms/cervix.js @@ -51,9 +51,9 @@ export default class Cervix extends Component { ] return ( - + - Opening + Opening - Firmness + Firmness - Position + Position - Exclude + Exclude { this.setState({ exclude: val }) diff --git a/components/cycle-day/symptoms/desire.js b/components/cycle-day/symptoms/desire.js index 2dd6fc6..2736483 100644 --- a/components/cycle-day/symptoms/desire.js +++ b/components/cycle-day/symptoms/desire.js @@ -29,7 +29,7 @@ export default class Desire extends Component { ] return ( - + - + - Feeling + Feeling - { - this.setState({ feeling: itemValue }) - }} - /> + {makeSelectBoxes(mucusFeelingBoxes, 'feeling')} - Texture + Texture - { - this.setState({ texture: itemValue }) - }} - /> + {makeSelectBoxes(mucusTextureRadioProps, 'texture')} - Exclude + Exclude { this.setState({ exclude: val }) @@ -106,3 +89,15 @@ export default class Mucus extends Component { ) } } + +function makeSelectBoxes(boxes, category) { + return boxes.map(({ label, value }) => { + return ( + this.setState({ [category]: value })} + key={value} + /> + ) + }) +} \ No newline at end of file diff --git a/components/cycle-day/symptoms/note.js b/components/cycle-day/symptoms/note.js index 6bf0cb6..ffbb543 100644 --- a/components/cycle-day/symptoms/note.js +++ b/components/cycle-day/symptoms/note.js @@ -24,7 +24,7 @@ export default class Temp extends Component { render() { return ( - + { + return ( + this.toggleState(stateKey)} + label={label} + key={stateKey} + /> + ) + }) + } + toggleState(key) { + const curr = this.state[key] + this.setState({[key]: !curr}) + } + + render() { return ( - - - - {activityLabels.solo} - { - this.setState({ solo: val }) - }} - /> - {activityLabels.partner} - { - this.setState({ partner: val }) - }} - /> - - CONTRACEPTIVES - - - {contraceptiveLabels.condom} - - { - this.setState({ condom: val }) - }} - /> - - {contraceptiveLabels.pill} - - { - this.setState({ pill: val }) - }} - /> - - - - {contraceptiveLabels.iud} - - { - this.setState({ iud: val }) - }} - /> - - {contraceptiveLabels.patch} - - { - this.setState({ patch: val }) - }} - /> - - - - {contraceptiveLabels.ring} - - { - this.setState({ ring: val }) - }} - /> - - {contraceptiveLabels.implant} - - { - this.setState({ implant: val }) - }} - /> - - - - {contraceptiveLabels.other} - - { - this.setState({ - other: val, - focusTextArea: true - }) - }} - /> - - {this.state.other && - { - this.setState({ note: val }) - }} - /> - } + + Activity + + {this.makeSelectBoxes(sexBoxes)} + Contraceptives + + {this.makeSelectBoxes(contraceptiveBoxes)} + { + this.toggleState('other') + this.setState({ focusTextArea: true }) + }} + /> + + {this.state.other && + { + this.setState({ note: val }) + }} + /> + } ) } -} \ No newline at end of file +} diff --git a/components/cycle-day/symptoms/temperature.js b/components/cycle-day/symptoms/temperature.js index ae7d74e..09be3be 100644 --- a/components/cycle-day/symptoms/temperature.js +++ b/components/cycle-day/symptoms/temperature.js @@ -96,10 +96,10 @@ export default class Temp extends Component { render() { return ( - + - Temperature (°C) + Temperature (°C) this.setState(val)} @@ -107,7 +107,7 @@ export default class Temp extends Component { /> - Time + Time { @@ -129,7 +129,7 @@ export default class Temp extends Component { onCancel={() => this.setState({ isTimePickerVisible: false })} /> - Note + Note - Exclude + Exclude { this.setState({ exclude: val }) diff --git a/styles/index.js b/styles/index.js index 70d0293..af29deb 100644 --- a/styles/index.js +++ b/styles/index.js @@ -23,9 +23,8 @@ export default StyleSheet.create({ textAlign: 'center', marginLeft: 15 }, - symptomDayView: { + symptomViewHeading: { fontSize: 20, - textAlignVertical: 'center' }, symptomBoxImage: { width: 50, @@ -198,6 +197,28 @@ export default StyleSheet.create({ fontSize: 15, color: fontOnPrimaryColor }, + selectBox: { + backgroundColor: 'lightgrey', + margin: 7, + paddingHorizontal: 15, + paddingVertical: 10, + borderRadius: 10 + }, + selectBoxActive: { + backgroundColor: secondaryColor, + color: fontOnPrimaryColor + }, + selectBoxTextActive: { + color: fontOnPrimaryColor + }, + selectBoxSection: { + flexDirection: 'row', + flexWrap: 'wrap', + marginVertical: 10, + }, + page: { + padding: 10 + } }) export const iconStyles = { @@ -217,5 +238,5 @@ export const iconStyles = { }, menuIconInactive: { color: 'lightgrey' - } + }, } \ No newline at end of file