diff --git a/src/Styles/ProfileStyles.js b/src/Styles/ProfileStyles.js new file mode 100644 index 0000000..029fa01 --- /dev/null +++ b/src/Styles/ProfileStyles.js @@ -0,0 +1,51 @@ +import { StyleSheet } from 'react-native'; + + +export const styles = StyleSheet.create({ + field: { + backgroundColor: '#FAFAFA', + paddingVertical: 4, + borderWidth: 1, + borderRadius: 7, + borderColor: 'gray', + marginHorizontal: 15, + marginBottom: 15, + marginTop: 15, + justifyContent: 'flex-start', + paddingLeft: 2, + paddingRight: 4, + flexDirection: 'row', + alignItems: 'center', + }, + + profileInfoScreen: { + flex: 1, + }, + + buttonContainer: { + paddingVertical: 10, + borderWidth: 1, + borderRadius: 7, + marginHorizontal: 15, + marginTop: 30, + marginBottom: 20, + backgroundColor: '#FF9500', + justifyContent: 'flex-end', + }, + + buttonText: { + textAlign: 'center', + color: '#FFF', + }, + + infoProfileBox: { + backgroundColor: 'white', + marginBottom: 9, + flex: 6, + flexDirection: 'column', + }, + + icon: { + margin: 7, + }, + }); \ No newline at end of file diff --git a/src/constants/profileInformations.js b/src/constants/profileInformations.js new file mode 100644 index 0000000..cd9df17 --- /dev/null +++ b/src/constants/profileInformations.js @@ -0,0 +1,39 @@ +export const PROFILE_FIELDS = [ + { + icon: 'face', + label: 'Nome:' + }, + { + icon: 'person', + label: 'CPF:' + }, + { + icon: 'phone', + label: 'Telefone:' + }, + { + icon: 'email', + label: 'Email:' + }, + { + icon: 'card-travel', + label: 'Cargo:' + }, + { + icon: 'supervisor-account', + label: 'Tipo de Conselheiro:' + }, + { + icon: 'people', + label: 'Segmento:' + }, + { + icon: 'location-city', + label: 'CAE:' + }, + { + icon: 'domain', + label: 'Tipo do CAE:' + }, + ] + \ No newline at end of file diff --git a/src/screens/ProfileInfoScreen.js b/src/screens/ProfileInfoScreen.js index 50f8ab1..6514dcb 100644 --- a/src/screens/ProfileInfoScreen.js +++ b/src/screens/ProfileInfoScreen.js @@ -6,90 +6,9 @@ import { MaterialIcons, FontAwesome } from '@expo/vector-icons'; import Header from '../components/Header'; import Button from '../components/Button'; import { backHandlerPopToMain } from '../NavigationFunctions'; +import { PROFILE_FIELDS } from '../constants/profileInformations'; +import { styles } from '../Styles/ProfileStyles'; -const styles = StyleSheet.create({ - field: { - backgroundColor: '#FAFAFA', - paddingVertical: 4, - borderWidth: 1, - borderRadius: 7, - borderColor: 'gray', - marginHorizontal: 15, - marginBottom: 15, - marginTop: 15, - justifyContent: 'flex-start', - paddingLeft: 2, - paddingRight: 4, - flexDirection: 'row', - alignItems: 'center', - }, - - profileInfoScreen: { - flex: 1, - }, - - buttonContainer: { - paddingVertical: 10, - borderWidth: 1, - borderRadius: 7, - marginHorizontal: 15, - marginTop: 30, - marginBottom: 20, - backgroundColor: '#FF9500', - justifyContent: 'flex-end', - }, - - buttonText: { - textAlign: 'center', - color: '#FFF', - }, - - infoProfileBox: { - backgroundColor: 'white', - marginBottom: 9, - flex: 6, - flexDirection: 'column', - }, - - icon: { - margin: 7, - }, -}); - -const profileInformations = { - icons: [ - 'face', - 'person', - 'phone', - 'email', - 'card-travel', - 'supervisor-account', - 'people', - 'location-city', - 'domain', - ], - labels: [ - 'Nome:', - 'CPF:', - 'Telefone:', - 'Email:', - 'Cargo:', - 'Tipo de Conselheiro:', - 'Segmento:', - 'CAE:', - 'Tipo do CAE:', - ], - informations: [ - this.props.counselor.name, - this.props.counselor.profile.cpf, - this.props.counselor.profile.phone, - this.props.counselor.email, - 'Cargo', - this.props.counselor.profile.segment, - this.props.counselor.profile.CAE, - this.props.counselor.profile.CAE_Type, - ] -} export default class ProfileInfoScreen extends React.Component { componentWillMount() { @@ -102,22 +21,24 @@ export default class ProfileInfoScreen extends React.Component { verifyCharge() { if (this.props.counselor.profile.isPresident) { - return ( - - - Cargo: Presidente - - ); + return "Presidente"; } - - return ( - - - Cargo: Conselheiro - - ); + return "Conselheiro"; } + render() { + informations = [ + this.props.counselor.name, + this.props.counselor.profile.cpf, + this.props.counselor.profile.phone, + this.props.counselor.email, + this.verifyCharge(), + this.props.counselor.profile.counselorType, + this.props.counselor.profile.segment, + this.props.counselor.profile.CAE, + this.props.counselor.profile.CAE_Type + ] + return (
- - - Nome: {this.props.counselor.name} - - - - CPF: {this.props.counselor.profile.cpf} - - - - Telefone: {this.props.counselor.profile.phone} - - - - Email: {this.props.counselor.email} - - {this.verifyCharge()} - - - Tipo do Conselheiro: {this.props.counselor.profile.counselorType} - - - - Segmento: {this.props.counselor.profile.segment} - - - - CAE: {this.props.counselor.profile.CAE} - - - - Tipo do CAE: {this.props.counselor.profile.CAE_Type} - + { + PROFILE_FIELDS.map((item, index) => ( + + + {item.label} {informations[index]} + + ) + ) + }