import React from 'react';
import {TouchableOpacity} from 'react-native';
import {Text, View, StyleSheet, ViewProps} from 'react-native';
import {normalize} from '../../utils';
import CloseIcon from '../../assets/ionicons/close-outline.svg';

interface IndividualMomentTitleBarProps extends ViewProps {
  title: string;
  close: () => void;
}
const IndividualMomentTitleBar: React.FC<IndividualMomentTitleBarProps> = ({
  title,
  close,
  style,
}) => {
  return (
    <View style={[styles.container, style]}>
      <TouchableOpacity style={styles.closeButton} onPress={close}>
        <CloseIcon height={'100%'} width={'100%'} color={'white'} />
      </TouchableOpacity>
      <View style={styles.headerContainer}>
        <Text style={styles.header}>{title}</Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'flex-start',
    height: '5%',
  },
  headerContainer: {
    width: '80%',
  },
  header: {
    textAlign: 'center',
    color: 'white',
    fontSize: normalize(18),
    fontWeight: '700',
    lineHeight: normalize(21.48),
    letterSpacing: normalize(1.3),
  },
  closeButton: {
    height: '50%',
    aspectRatio: 1,
    left: '8%',
  },
});

export default IndividualMomentTitleBar;
