Make symptom section component
This commit is contained in:
@@ -9,7 +9,7 @@ import { saveSymptom } from '../../../db'
|
|||||||
import { bleeding as labels } from '../labels/labels'
|
import { bleeding as labels } from '../labels/labels'
|
||||||
import ActionButtonFooter from './action-button-footer'
|
import ActionButtonFooter from './action-button-footer'
|
||||||
import SelectTabGroup from '../select-tab-group'
|
import SelectTabGroup from '../select-tab-group'
|
||||||
import { SymptomSectionHeader, AppText } from '../../app-text'
|
import SymptomSection from './symptom-section'
|
||||||
|
|
||||||
export default class Bleeding extends Component {
|
export default class Bleeding extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -36,27 +36,28 @@ export default class Bleeding extends Component {
|
|||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<ScrollView style={styles.page}>
|
<ScrollView style={styles.page}>
|
||||||
<View>
|
<SymptomSection
|
||||||
<SymptomSectionHeader>Heaviness</SymptomSectionHeader>
|
header="Heaviness"
|
||||||
<AppText>How heavy is the bleeding?</AppText>
|
explainer="How heavy is the bleeding?"
|
||||||
|
>
|
||||||
<SelectTabGroup
|
<SelectTabGroup
|
||||||
buttons={bleedingRadioProps}
|
buttons={bleedingRadioProps}
|
||||||
active={this.state.currentValue}
|
active={this.state.currentValue}
|
||||||
onSelect={val => this.setState({ currentValue: val })}
|
onSelect={val => this.setState({ currentValue: val })}
|
||||||
/>
|
/>
|
||||||
<SymptomSectionHeader>Exclude</SymptomSectionHeader>
|
</SymptomSection>
|
||||||
<View flexDirection={'row'}>
|
<SymptomSection
|
||||||
<View flex={1}>
|
header="Exclude"
|
||||||
<AppText>{"You can exclude this value if it's not menstrual bleeding"}</AppText>
|
explainer="You can exclude this value if it's not menstrual bleeding"
|
||||||
</View>
|
inlineExplainer={true}
|
||||||
<Switch
|
>
|
||||||
onValueChange={(val) => {
|
<Switch
|
||||||
this.setState({ exclude: val })
|
onValueChange={(val) => {
|
||||||
}}
|
this.setState({ exclude: val })
|
||||||
value={this.state.exclude}
|
}}
|
||||||
/>
|
value={this.state.exclude}
|
||||||
</View>
|
/>
|
||||||
</View>
|
</SymptomSection>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<ActionButtonFooter
|
<ActionButtonFooter
|
||||||
symptom='bleeding'
|
symptom='bleeding'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { saveSymptom } from '../../../db'
|
|||||||
import { cervix as labels } from '../labels/labels'
|
import { cervix as labels } from '../labels/labels'
|
||||||
import ActionButtonFooter from './action-button-footer'
|
import ActionButtonFooter from './action-button-footer'
|
||||||
import SelectTabGroup from '../select-tab-group'
|
import SelectTabGroup from '../select-tab-group'
|
||||||
import { SymptomSectionHeader, AppText } from '../../app-text'
|
import SymptomSection from './symptom-section'
|
||||||
|
|
||||||
export default class Cervix extends Component {
|
export default class Cervix extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -48,36 +48,48 @@ export default class Cervix extends Component {
|
|||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<ScrollView style={styles.page}>
|
<ScrollView style={styles.page}>
|
||||||
<SymptomSectionHeader>Opening</SymptomSectionHeader>
|
<SymptomSection
|
||||||
<AppText>{labels.opening.explainer}</AppText>
|
header="Opening"
|
||||||
<SelectTabGroup
|
explainer={labels.opening.explainer}
|
||||||
buttons={cervixOpeningRadioProps}
|
>
|
||||||
active={this.state.opening}
|
<SelectTabGroup
|
||||||
onSelect={val => this.setState({ opening: val })}
|
buttons={cervixOpeningRadioProps}
|
||||||
/>
|
active={this.state.opening}
|
||||||
<SymptomSectionHeader>Firmness</SymptomSectionHeader>
|
onSelect={val => this.setState({ opening: val })}
|
||||||
<AppText>{labels.firmness.explainer}</AppText>
|
/>
|
||||||
<SelectTabGroup
|
</SymptomSection>
|
||||||
buttons={cervixFirmnessRadioProps}
|
<SymptomSection
|
||||||
active={this.state.firmness}
|
header="Firmness"
|
||||||
onSelect={val => this.setState({ firmness: val })}
|
explainer={labels.firmness.explainer}
|
||||||
/>
|
>
|
||||||
<SymptomSectionHeader>Position</SymptomSectionHeader>
|
<SelectTabGroup
|
||||||
<AppText>{labels.position.explainer}</AppText>
|
buttons={cervixFirmnessRadioProps}
|
||||||
<SelectTabGroup
|
active={this.state.firmness}
|
||||||
buttons={cervixPositionRadioProps}
|
onSelect={val => this.setState({ firmness: val })}
|
||||||
active={this.state.position}
|
/>
|
||||||
onSelect={val => this.setState({ position: val })}
|
</SymptomSection>
|
||||||
/>
|
<SymptomSection
|
||||||
<View style={styles.symptomViewRowInline}>
|
header="Position"
|
||||||
<SymptomSectionHeader>Exclude</SymptomSectionHeader>
|
explainer={labels.position.explainer}
|
||||||
|
>
|
||||||
|
<SelectTabGroup
|
||||||
|
buttons={cervixPositionRadioProps}
|
||||||
|
active={this.state.position}
|
||||||
|
onSelect={val => this.setState({ position: val })}
|
||||||
|
/>
|
||||||
|
</SymptomSection>
|
||||||
|
<SymptomSection
|
||||||
|
header="Exclude"
|
||||||
|
explainer="You can exclude this value if you don't want to use it for fertility detection"
|
||||||
|
inlineExplainer={true}
|
||||||
|
>
|
||||||
<Switch
|
<Switch
|
||||||
onValueChange={(val) => {
|
onValueChange={(val) => {
|
||||||
this.setState({ exclude: val })
|
this.setState({ exclude: val })
|
||||||
}}
|
}}
|
||||||
value={this.state.exclude}
|
value={this.state.exclude}
|
||||||
/>
|
/>
|
||||||
</View>
|
</SymptomSection>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<ActionButtonFooter
|
<ActionButtonFooter
|
||||||
symptom='cervix'
|
symptom='cervix'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { saveSymptom } from '../../../db'
|
|||||||
import { intensity, desire } from '../labels/labels'
|
import { intensity, desire } from '../labels/labels'
|
||||||
import ActionButtonFooter from './action-button-footer'
|
import ActionButtonFooter from './action-button-footer'
|
||||||
import SelectTabGroup from '../select-tab-group'
|
import SelectTabGroup from '../select-tab-group'
|
||||||
import { SymptomSectionHeader, AppText } from '../../app-text';
|
import SymptomSection from './symptom-section'
|
||||||
|
|
||||||
export default class Desire extends Component {
|
export default class Desire extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -31,13 +31,16 @@ export default class Desire extends Component {
|
|||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<ScrollView style={styles.page}>
|
<ScrollView style={styles.page}>
|
||||||
<SymptomSectionHeader>{desire.header}</SymptomSectionHeader>
|
<SymptomSection
|
||||||
<AppText>{desire.explainer}</AppText>
|
header={desire.header}
|
||||||
<SelectTabGroup
|
explainer={desire.explainer}
|
||||||
buttons={desireRadioProps}
|
>
|
||||||
acitve={this.state.currentValue}
|
<SelectTabGroup
|
||||||
onSelect={val => this.setState({ currentValue: val })}
|
buttons={desireRadioProps}
|
||||||
/>
|
acitve={this.state.currentValue}
|
||||||
|
onSelect={val => this.setState({ currentValue: val })}
|
||||||
|
/>
|
||||||
|
</SymptomSection>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<ActionButtonFooter
|
<ActionButtonFooter
|
||||||
symptom='desire'
|
symptom='desire'
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import React, { Component } from 'react'
|
||||||
|
import { View } from 'react-native'
|
||||||
|
import { SymptomSectionHeader, AppText } from '../../app-text'
|
||||||
|
|
||||||
|
export default class SymptomSection extends Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<SymptomSectionHeader>{this.props.header}</SymptomSectionHeader>
|
||||||
|
<View flexDirection={this.props.inlineExplainer ? 'row' : 'column'}>
|
||||||
|
<View flex={1}>
|
||||||
|
<AppText>{this.props.explainer}</AppText>
|
||||||
|
</View>
|
||||||
|
{this.props.children}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user