import React from 'react'; import { View, TouchableOpacity, Text, StyleSheet, useWindowDimensions } from 'react-native'; import { MaterialIcons } from '@expo/vector-icons'; import { useTheme } from '../ThemeProvider'; import { useRouter } from 'expo-router'; interface HeaderProps { title: string; showAddDeck?: boolean; showPresent?: boolean; onPresentPress?: () => void; disabled?: boolean; slideCount?: number; rightContent?: React.ReactNode; position?: 'top' | 'bottom'; } export const Header: React.FC = ({ title, showAddDeck = false, showPresent = false, onPresentPress, disabled = false, slideCount, rightContent, position = 'top', }) => { const router = useRouter(); const { theme } = useTheme(); const { width } = useWindowDimensions(); const isMobile = width < 768; const shouldBeBottom = isMobile && position === 'bottom'; const defaultRightContent = ( {!showPresent && ( router.push('/profile')} style={styles.iconButton}> )} {showPresent && ( )} router.push('/settings')} style={styles.iconButton}> {showAddDeck && ( { const event = new CustomEvent('openCreateDeckModal'); window.dispatchEvent(event); }} style={styles.iconButton} > )} ); return ( {title} {typeof slideCount === 'number' && ( {slideCount} Slides )} {rightContent || defaultRightContent} ); }; const styles = StyleSheet.create({ header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', height: 56, gap: 16, }, titleContainer: { flex: 1, maxWidth: '50%', }, titleContent: { padding: 8, width: '100%', }, rightContainer: { flex: 1, maxWidth: '50%', }, title: { fontSize: 20, fontWeight: 'bold', }, subtitle: { fontSize: 14, marginTop: 2, }, rightContent: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%', gap: 8, padding: 8, }, iconWrapper: { flex: 1, borderWidth: 1, borderRadius: 8, padding: 4, }, iconButton: { padding: 4, alignItems: 'center', justifyContent: 'center', width: '100%', }, });