Header.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React, { Component } from 'react';
  2. import { Image, Text, View, TouchableOpacity } from 'react-native';
  3. import { Actions } from 'react-native-router-flux';
  4. import { CardSection } from '../../components/common';
  5. import Icon from 'react-native-vector-icons/Ionicons'
  6. class Header extends Component {
  7. renderProf(p) {
  8. if ( p === undefined )
  9. return null;
  10. if (!Array.isArray(p))
  11. p = [ p ];
  12. const out = p.map( e => {
  13. return (
  14. <TouchableOpacity key={e._id} onPress={() => Actions.ViewProf({ id: e._id})}>
  15. <Text style={styles.info}>
  16. {e.nombre} {e.apellido}
  17. </Text>
  18. </TouchableOpacity>
  19. );
  20. });
  21. return <View style={{ flexDirection: 'column' }}>{out}</View>;
  22. }
  23. render() {
  24. const moment = require('moment');
  25. const professor = require('../../../img/listaClases/profesor.png');
  26. const calendar = require('../../../img/listaClases/calendario.png');
  27. const fecha = moment(this.props.fecha).local().format('DD/MM/YY');
  28. return (
  29. <View style={{ borderWidth: 1, borderColor: '#ddd', padding: 5 }}>
  30. <Text style={styles.title}>{this.props.titulo}</Text>
  31. <CardSection>
  32. <View style={styles.infoSection}>
  33. <Icon name='ios-person-outline' style={styles.icon} />
  34. {this.renderProf(this.props.profesor)}
  35. </View>
  36. <View style={styles.infoSection}>
  37. <Icon name='ios-calendar-outline' style={styles.icon} />
  38. <Text style={styles.info}>{fecha}</Text>
  39. </View>
  40. <View style={styles.infoSection}>
  41. <Icon name='ios-help-outline' style={styles.icon} />
  42. <Text style={styles.info}>Sin Resolver</Text>
  43. </View>
  44. </CardSection>
  45. </View>
  46. );
  47. }
  48. }
  49. const styles = {
  50. title: {
  51. color: '#000',
  52. fontWeight: '600',
  53. fontSize: 11
  54. },
  55. info: {
  56. color: '#88A',
  57. fontSize: 11
  58. },
  59. icon: {
  60. fontSize: 18,
  61. marginRight: 5
  62. },
  63. infoSection: {
  64. flex: 1,
  65. flexDirection: 'row',
  66. alignItems: 'center'
  67. }
  68. };
  69. export default Header;