import React, {FC, ReactNode} from 'react'; import { Image, ImageURISource, StyleProp, StyleSheet, TouchableOpacity, View, ViewStyle, } from 'react-native'; import {SPACING_6, SPACING_10} from '../Spacing/Spacing'; import IconComponent from '../Icon/IconComponent'; import {icons} from '../Icon/Icons'; import PlayyText from '../PlayyText/PlayyText'; import {useHeaderContext} from './Header'; import {GLYPHS} from '../Glyphs'; interface HeaderLeftProps { children?: ReactNode; backIcon?: boolean; backIconColor?: string; label?: string; labelColor?: string; onBackPress?: () => void; showLeading?: boolean; leadingSource?: ImageURISource; leadingContainerStyle?: StyleProp; onLeadingPress?: () => void; isContact?: boolean; contactSource?: ImageURISource; contactName?: string; contactTitle?: string; contactSubTitle?: string; isOnline?: boolean; } const HeaderLeft: FC = ({ children, backIcon, backIconColor, label, labelColor, onBackPress, showLeading, leadingSource, leadingContainerStyle, onLeadingPress, isContact, contactSource, contactName, contactTitle, contactSubTitle, isOnline, }) => { const {colors} = useHeaderContext(); const styles = themedStyle(); if (children) { return {children}; } return ( {showLeading && ( {leadingSource && ( )} )} {backIcon && ( {GLYPHS['chevron-left-strong'].char} )} {label && ( {label} )} {isContact && ( {contactSource ? ( ) : ( {contactName} )} {isOnline && ( )} {contactTitle} {contactSubTitle} )} ); }; const themedStyle = () => StyleSheet.create({ leftSection: { flex: 1, justifyContent: 'flex-start', alignItems: 'flex-start', }, backIconContainer: { flexDirection: 'row', alignItems: 'center', gap: SPACING_6, }, leadingContainer: { width: 40, height: 40, borderRadius: 40, overflow: 'hidden', }, leadingImage: { width: '100%', height: '100%', borderRadius: 100, overflow: 'hidden', }, headerContactContainer: { flexDirection: 'row', alignItems: 'center', gap: SPACING_10, }, contactAvatar: { position: 'relative', width: 40, height: 40, borderRadius: 40, }, onlineContainer: { width: 18, height: 18, borderRadius: 9, backgroundColor: 'white', justifyContent: 'center', alignItems: 'center', position: 'absolute', zIndex: 2, bottom: 0, right: -2, }, }); export default HeaderLeft;