Introduces AppLoading, AppTextInput, Button components redesign
This commit is contained in:
@@ -1,18 +1,24 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { StyleSheet, View } from 'react-native'
|
||||||
import { View } from 'react-native'
|
|
||||||
|
|
||||||
import AppText from './app-text'
|
import AppText from './app-text'
|
||||||
|
|
||||||
|
import { Containers } from '../../styles/redesign'
|
||||||
|
|
||||||
import { shared } from '../../i18n/en/labels'
|
import { shared } from '../../i18n/en/labels'
|
||||||
|
|
||||||
const AppLoadingView = () => {
|
const AppLoadingView = () => {
|
||||||
return (
|
return (
|
||||||
<View flex={1}>
|
<View style={styles.container}>
|
||||||
<View style={{flex:1, justifyContent: 'center'}}>
|
<AppText>{shared.loading}</AppText>
|
||||||
<AppText style={{alignSelf: 'center'}}>{shared.loading}</AppText>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
...Containers.centerItems
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
export default AppLoadingView
|
export default AppLoadingView
|
||||||
|
|||||||
@@ -1,17 +1,26 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { TextInput } from 'react-native'
|
import { StyleSheet, TextInput } from 'react-native'
|
||||||
import styles from '../../styles'
|
|
||||||
|
|
||||||
export default function AppTextInput({ style, ...props }) {
|
import { Containers } from '../../styles/redesign'
|
||||||
|
|
||||||
|
const AppTextInput = ({
|
||||||
|
autoFocus,
|
||||||
|
onChangeText,
|
||||||
|
placeholder,
|
||||||
|
value,
|
||||||
|
style,
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
if (!Array.isArray(style)) style = [style]
|
if (!Array.isArray(style)) style = [style]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TextInput
|
<TextInput
|
||||||
style={[styles.textInputField, ...style]}
|
autoFocus={autoFocus}
|
||||||
autoFocus={props.autoFocus}
|
onChangeText={onChangeText}
|
||||||
onChangeText={props.onChangeText}
|
placeholder={placeholder}
|
||||||
value={props.value}
|
style={[styles.input, ...style]}
|
||||||
placeholder={props.placeholder}
|
value={value}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -28,3 +37,11 @@ AppTextInput.propTypes = {
|
|||||||
AppTextInput.defaultProps = {
|
AppTextInput.defaultProps = {
|
||||||
style: []
|
style: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
input: {
|
||||||
|
...Containers.greyBorder
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default AppTextInput
|
||||||
|
|||||||
+25
-18
@@ -1,31 +1,38 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { TouchableOpacity } from 'react-native'
|
import { StyleSheet, TouchableOpacity } from 'react-native'
|
||||||
import AppText from './app-text'
|
|
||||||
import styles from '../../styles'
|
|
||||||
|
|
||||||
export default function Button({
|
import AppText from './app-text'
|
||||||
backgroundColor,
|
|
||||||
children,
|
import { Containers, Typography } from '../../styles/redesign'
|
||||||
onPress,
|
|
||||||
style,
|
const Button = ({ children, isOrange, onPress, testID }) => {
|
||||||
testID
|
const buttonStyle = isOrange ? styles.orange : {}
|
||||||
}) {
|
const textStyle = isOrange ? styles.buttonTextBold : styles.buttonTextRegular
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity onPress={onPress} style={buttonStyle} testID={testID}>
|
||||||
onPress={onPress}
|
<AppText style={textStyle}>{children}</AppText>
|
||||||
style={[styles.button, style, { backgroundColor }]}
|
|
||||||
testID={testID}
|
|
||||||
>
|
|
||||||
<AppText style={styles.homeButtonText}>{children}</AppText>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Button.propTypes = {
|
Button.propTypes = {
|
||||||
backgroundColor: PropTypes.string,
|
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
|
isOrange: PropTypes.bool,
|
||||||
onPress: PropTypes.func,
|
onPress: PropTypes.func,
|
||||||
style: PropTypes.object,
|
|
||||||
testID: PropTypes.string
|
testID: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
orange: {
|
||||||
|
...Containers.orangeButton
|
||||||
|
},
|
||||||
|
buttonTextBold: {
|
||||||
|
...Typography.buttonTextBold
|
||||||
|
},
|
||||||
|
buttonTextRegular: {
|
||||||
|
...Typography.buttonTextRegular
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default Button
|
||||||
|
|||||||
@@ -13,6 +13,16 @@ export default {
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
},
|
},
|
||||||
|
greyBorder: {
|
||||||
|
borderColor: Colors.greyLight,
|
||||||
|
borderRadius: 5,
|
||||||
|
borderStyle: 'solid',
|
||||||
|
borderWidth: 1,
|
||||||
|
},
|
||||||
marginBottom: { marginBottom: Spacing.base },
|
marginBottom: { marginBottom: Spacing.base },
|
||||||
|
orangeButton: {
|
||||||
|
backgroundColor: Colors.orange,
|
||||||
|
borderRadius: 25
|
||||||
|
},
|
||||||
segmentContainer: { marginHorizontal: Spacing.base }
|
segmentContainer: { marginHorizontal: Spacing.base }
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
export default {
|
export default {
|
||||||
base: 16
|
base: 16,
|
||||||
|
large: 20
|
||||||
}
|
}
|
||||||
+16
-2
@@ -14,15 +14,29 @@ const sizes = {
|
|||||||
titleLarge: 28
|
titleLarge: 28
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const button = {
|
||||||
|
paddingHorizontal: Spacing.large,
|
||||||
|
paddingVertical: Spacing.base,
|
||||||
|
textTransform: 'uppercase'
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
buttonTextBold: {
|
||||||
|
fontFamily: fonts.bold,
|
||||||
|
...button
|
||||||
|
},
|
||||||
|
buttonTextRegular: {
|
||||||
|
fontFamily: fonts.main,
|
||||||
|
...button
|
||||||
|
},
|
||||||
mainText: {
|
mainText: {
|
||||||
fontFamily: fonts.main,
|
fontFamily: fonts.main,
|
||||||
fontSize: sizes.mainMedium
|
fontSize: sizes.mainMedium
|
||||||
},
|
},
|
||||||
underline: { textDecorationLine: 'underline' },
|
|
||||||
titleSmall: {
|
titleSmall: {
|
||||||
color: Colors.purple,
|
color: Colors.purple,
|
||||||
fontSize: sizes.titleSmall,
|
fontSize: sizes.titleSmall,
|
||||||
marginVertical: Spacing.base
|
marginVertical: Spacing.base
|
||||||
}
|
},
|
||||||
|
underline: { textDecorationLine: 'underline' }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user