Moves out IconText component
This commit is contained in:
+4
-17
@@ -17,18 +17,9 @@ import { getFertilityStatusForDay } from '../lib/sympto-adapter'
|
|||||||
import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles'
|
import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles'
|
||||||
import AppText from './app-text'
|
import AppText from './app-text'
|
||||||
import Button from './button'
|
import Button from './button'
|
||||||
|
import IconText from './icon-text'
|
||||||
import { formatDateForShortText } from './helpers/format-date'
|
import { formatDateForShortText } from './helpers/format-date'
|
||||||
|
|
||||||
const IconText = ({ children, wrapperStyles }) => {
|
|
||||||
return (
|
|
||||||
<View style={[styles.homeIconTextWrapper, wrapperStyles]}>
|
|
||||||
<AppText style={styles.iconText}>
|
|
||||||
{ children }
|
|
||||||
</AppText>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => {
|
const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
@@ -106,9 +97,7 @@ class Home extends Component {
|
|||||||
<View>
|
<View>
|
||||||
<DripHomeIcon name="circle" size={80} color={cycleDayColor}/>
|
<DripHomeIcon name="circle" size={80} color={cycleDayColor}/>
|
||||||
</View>
|
</View>
|
||||||
<IconText wrapperStyles={styles.wrapperIcon}>
|
<IconText>{cycleDayNumber || labels.unknown}</IconText>
|
||||||
{cycleDayNumber || labels.unknown}
|
|
||||||
</IconText>
|
|
||||||
|
|
||||||
<AppText style={styles.homeDescriptionText}>
|
<AppText style={styles.homeDescriptionText}>
|
||||||
{cycleDayMoreText}
|
{cycleDayMoreText}
|
||||||
@@ -122,7 +111,7 @@ class Home extends Component {
|
|||||||
>
|
>
|
||||||
<DripHomeIcon name="drop" size={100} color={periodColor} />
|
<DripHomeIcon name="drop" size={100} color={periodColor} />
|
||||||
|
|
||||||
<IconText wrapperStyles={{top: '45%', ...styles.wrapperIcon}}>
|
<IconText wrapperStyles={{ top: '45%' }}>
|
||||||
{this.state.bleedingPredictionRange}
|
{this.state.bleedingPredictionRange}
|
||||||
</IconText>
|
</IconText>
|
||||||
|
|
||||||
@@ -138,9 +127,7 @@ class Home extends Component {
|
|||||||
>
|
>
|
||||||
<View style={styles.homeCircle}/>
|
<View style={styles.homeCircle}/>
|
||||||
|
|
||||||
<IconText wrapperStyles={styles.wrapperIcon}>
|
<IconText>{ phase ? phase.toString() : labels.unknown }</IconText>
|
||||||
{ phase ? phase.toString() : labels.unknown }
|
|
||||||
</IconText>
|
|
||||||
|
|
||||||
{ phase &&
|
{ phase &&
|
||||||
<AppText style={styles.homeDescriptionText}>
|
<AppText style={styles.homeDescriptionText}>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { View } from 'react-native'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
|
import AppText from './app-text'
|
||||||
|
|
||||||
|
import styles from '../styles'
|
||||||
|
|
||||||
|
const IconText = ({ children, wrapperStyles }) => {
|
||||||
|
return (
|
||||||
|
<View style={[ styles.homeIconTextWrapper, wrapperStyles ]}>
|
||||||
|
<AppText style={styles.iconText}>
|
||||||
|
{ children }
|
||||||
|
</AppText>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
IconText.propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
|
wrapperStyles: PropTypes.object,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IconText
|
||||||
+2
-4
@@ -131,14 +131,12 @@ export default StyleSheet.create({
|
|||||||
homeIconTextWrapper: {
|
homeIconTextWrapper: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
width: 80,
|
||||||
|
position: 'absolute',
|
||||||
},
|
},
|
||||||
homeIconAndText: {
|
homeIconAndText: {
|
||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
},
|
},
|
||||||
wrapperIcon: {
|
|
||||||
width: 80,
|
|
||||||
position: 'absolute'
|
|
||||||
},
|
|
||||||
homeCircle: {
|
homeCircle: {
|
||||||
borderRadius: 100,
|
borderRadius: 100,
|
||||||
borderWidth: 2.3,
|
borderWidth: 2.3,
|
||||||
|
|||||||
Reference in New Issue
Block a user