Rearrange segments in customization + add subheader

This commit is contained in:
bl00dymarie
2024-03-16 14:39:38 +01:00
parent b481bd8352
commit 56e90b69e6
4 changed files with 26 additions and 11 deletions
+8 -1
View File
@@ -6,13 +6,14 @@ import AppText from './app-text'
import { Colors, Containers, Spacing, Typography } from '../../styles' import { Colors, Containers, Spacing, Typography } from '../../styles'
const Segment = ({ children, last, title }) => { const Segment = ({ children, last, title, subheader }) => {
const containerStyle = last ? styles.containerLast : styles.container const containerStyle = last ? styles.containerLast : styles.container
const commonStyle = Object.assign({}, containerStyle) const commonStyle = Object.assign({}, containerStyle)
return ( return (
<View style={commonStyle}> <View style={commonStyle}>
{title && <AppText style={styles.title}>{title}</AppText>} {title && <AppText style={styles.title}>{title}</AppText>}
{subheader && <AppText style={styles.subheader}>{subheader}</AppText>}
{children} {children}
</View> </View>
) )
@@ -23,6 +24,7 @@ Segment.propTypes = {
last: PropTypes.bool, last: PropTypes.bool,
style: PropTypes.object, style: PropTypes.object,
title: PropTypes.string, title: PropTypes.string,
subheader: PropTypes.string,
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@@ -39,6 +41,11 @@ const styles = StyleSheet.create({
title: { title: {
...Typography.subtitle, ...Typography.subtitle,
}, },
subheader: {
...Typography.subtitle,
fontWeight: 'bold',
marginBottom: Spacing.zero,
},
}) })
export default Segment export default Segment
+15 -9
View File
@@ -274,6 +274,7 @@ const Settings = () => {
symptom={SYMPTOMS[8]} symptom={SYMPTOMS[8]}
/> />
</Segment> </Segment>
<Pressable onPress={fertilityDisabledPrompt}> <Pressable onPress={fertilityDisabledPrompt}>
<Segment title={labels.fertilityTracking.title}> <Segment title={labels.fertilityTracking.title}>
<AppText>{labels.fertilityTracking.message}</AppText> <AppText>{labels.fertilityTracking.message}</AppText>
@@ -286,6 +287,19 @@ const Settings = () => {
</Segment> </Segment>
</Pressable> </Pressable>
<Segment title={labels.periodPrediction.title}>
<AppSwitch
onToggle={onPeriodPredictionToggle}
text={periodPredictionText}
value={isPeriodPredictionEnabled}
/>
</Segment>
<Segment
subheader={labels.customization.subheaderSymptoThermalMethod}
last
></Segment>
<Pressable onPress={sliderDisabledPrompt}> <Pressable onPress={sliderDisabledPrompt}>
<Segment title={labels.tempScale.segmentTitle}> <Segment title={labels.tempScale.segmentTitle}>
<AppText>{labels.tempScale.segmentExplainer}</AppText> <AppText>{labels.tempScale.segmentExplainer}</AppText>
@@ -294,7 +308,7 @@ const Settings = () => {
</Pressable> </Pressable>
<Pressable onPress={secondarySymptomDisabledPrompt}> <Pressable onPress={secondarySymptomDisabledPrompt}>
<Segment title={labels.secondarySymptom.title}> <Segment last title={labels.secondarySymptom.title}>
<AppText>{cervixText}</AppText> <AppText>{cervixText}</AppText>
<SelectTabGroup <SelectTabGroup
activeButton={useCervixAsSecondarySymptom} activeButton={useCervixAsSecondarySymptom}
@@ -304,14 +318,6 @@ const Settings = () => {
/> />
</Segment> </Segment>
</Pressable> </Pressable>
<Segment title={labels.periodPrediction.title} last>
<AppSwitch
onToggle={onPeriodPredictionToggle}
text={periodPredictionText}
value={isPeriodPredictionEnabled}
/>
</Segment>
</AppPage> </AppPage>
) )
} }
+1
View File
@@ -4,6 +4,7 @@ export default {
customization: { customization: {
title: 'Customization', title: 'Customization',
trackingCategories: 'Tracking categories', trackingCategories: 'Tracking categories',
subheaderSymptoThermalMethod: 'Sympto-thermal method settings',
}, },
export: { export: {
errors: { errors: {
+2 -1
View File
@@ -1,10 +1,11 @@
import { scale } from 'react-native-size-matters' import { scale } from 'react-native-size-matters'
export default { export default {
zero: '0%',
tiny: scale(4), tiny: scale(4),
small: scale(10), small: scale(10),
base: scale(16), base: scale(16),
large: scale(20), large: scale(20),
symptomTileWidth: '48%', symptomTileWidth: '48%',
textWidth: '70%' textWidth: '70%',
} }