Skip to content
Snippets Groups Projects
Commit 3f8f6dbb authored by mashazyu's avatar mashazyu Committed by Sofiya Tepikin
Browse files

Introduces AppLoading, AppTextInput, Button components redesign

parent 8c1c72cc
No related branches found
No related tags found
No related merge requests found
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
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 = { ...@@ -28,3 +37,11 @@ AppTextInput.propTypes = {
AppTextInput.defaultProps = { AppTextInput.defaultProps = {
style: [] style: []
} }
const styles = StyleSheet.create({
input: {
...Containers.greyBorder
}
})
export default AppTextInput
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 AppText from './app-text'
import styles from '../../styles'
export default function Button({ import { Containers, Typography } from '../../styles/redesign'
backgroundColor,
children, const Button = ({ children, isOrange, onPress, testID }) => {
onPress, const buttonStyle = isOrange ? styles.orange : {}
style, const textStyle = isOrange ? styles.buttonTextBold : styles.buttonTextRegular
testID
}) {
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 { ...@@ -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 }
} }
\ No newline at end of file
export default { export default {
base: 16 base: 16,
large: 20
} }
\ No newline at end of file
...@@ -14,15 +14,29 @@ const sizes = { ...@@ -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' }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment