WishListComponent.js 4.16 KB
Newer Older
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
1 2
/* eslint-disable prettier/prettier */
import React from 'react';
3 4
import {
  Dimensions,
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
5
  Image,
6
  StyleSheet,
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
7 8
  TouchableOpacity,
  View,
9 10 11
} from 'react-native';
import FastImage from 'react-native-fast-image';
import {GifType} from '../../../values/images';
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
12
import AppText from '../../../components/AppText';
13 14 15 16 17 18 19 20 21 22
const windowWidth = Dimensions.get('window').width;
const WishListComponent = ({
  userDetails,
  openView,
  openModalHappyBirthday,
  closeModalHappyBirthday,
  dataBirthday,
}) => {
  return (
    <View style={styles.viewContent}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
23 24 25
      <AppText style={[styles.txtTitle, {padding: 10}]}>
        Li chúc sinh nht
      </AppText>
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

      {dataBirthday.map((item, index) => (
        <View
          key={index}
          style={[
            styles.viewHappyBirthday,
            openView[index].enable
              ? styles.openViewHappyBirthday
              : styles.closeViewHappyBirthday,
          ]}>
          <View style={{flexDirection: 'row'}}>
            <View
              style={{
                flexDirection: 'row',
                flex: openView[index].enable ? 1 : 0,
              }}>
              <Image
                source={{
                  uri: 'https://meu.anawork.com' + item.extend_avatar,
                }}
                style={{width: 40, height: 40}}
              />
              <View style={{paddingLeft: 10}}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
49
                <AppText style={styles.txtTitle}>
50
                  {item.extend_sender_full_name}
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
51 52
                </AppText>
                <AppText>{item.position}</AppText>
53 54 55 56 57 58 59
              </View>
            </View>
            {!openView[index].enable && (
              <View style={{alignItems: 'flex-end', flex: 1}}>
                <TouchableOpacity
                  onPress={() => openModalHappyBirthday(index)}
                  style={styles.btnOpenHappyBirthday}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
60 61 62
                  <AppText style={{color: 'blue', fontWeight: '500'}}>
                    Xem
                  </AppText>
63 64 65 66 67 68 69
                </TouchableOpacity>
              </View>
            )}
          </View>
          {openView[index].enable && (
            <View>
              <View style={{marginTop: 10}}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
70
                <AppText style={[styles.txtTitle]}>{item?.details}</AppText>
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
                {item.image_path && (
                  <Image
                    source={{
                      uri: 'https://meu.anawork.com' + item.image_path,
                    }}
                    style={{
                      width: 60,
                      height: 60,
                      alignSelf: 'center',
                      marginTop: 10,
                    }}
                  />
                )}
                {!item.image_path && (
                  <FastImage
                    source={GifType.gifBirthdayCake}
                    style={{
                      width: 60,
                      height: 60,
                      alignSelf: 'center',
                      marginTop: 10,
                    }}
                  />
                )}
              </View>
              <TouchableOpacity
                onPress={() => closeModalHappyBirthday(index)}
                style={{alignSelf: 'flex-end'}}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
99 100 101 102
                <AppText style={{color: 'blue', fontWeight: '600'}}>
                  {' '}
                  Đóng
                </AppText>
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
              </TouchableOpacity>
            </View>
          )}
        </View>
      ))}
    </View>
  );
};
const styles = StyleSheet.create({
  viewContent: {
    borderWidth: 1,
    width: windowWidth - 20,
    borderColor: 'white',
    backgroundColor: 'white',
    alignSelf: 'center',
    marginTop: 10,
    marginBottom: 10,
  },
  txtTitle: {
    color: 'black',
    fontSize: 15,
    fontWeight: '500',
  },
  openViewHappyBirthday: {
    borderLeftWidth: 4,
    borderLeftColor: 'blue',
  },
  closeViewHappyBirthday: {
    borderLeftWidth: 1,
  },
  viewHappyBirthday: {
    padding: 20,
    marginVertical: 8,
    marginHorizontal: 16,
    borderWidth: 1,
    borderBottomColor: '#f2f2f2',
    borderTopColor: '#f2f2f2',
    borderRightColor: '#f2f2f2',
    borderTopLeftRadius: 10,
    borderBottomLeftRadius: 10,
    justifyContent: 'space-between',
  },
});
export default WishListComponent;