POWR/components/Header.tsx

36 lines
963 B
TypeScript
Raw Normal View History

2025-02-09 20:38:38 -05:00
// components/Header.tsx
import React from 'react';
2025-02-12 12:55:51 -05:00
import { View, Platform } from 'react-native';
2025-02-09 20:38:38 -05:00
import { Text } from '@/components/ui/text';
2025-02-12 12:55:51 -05:00
import { useSafeAreaInsets } from 'react-native-safe-area-context';
2025-02-09 20:38:38 -05:00
interface HeaderProps {
title: string;
rightElement?: React.ReactNode;
2025-02-12 12:55:51 -05:00
children?: React.ReactNode;
2025-02-09 20:38:38 -05:00
}
2025-02-12 12:55:51 -05:00
export default function Header({ title, rightElement, children }: HeaderProps) {
const insets = useSafeAreaInsets();
2025-02-09 20:38:38 -05:00
return (
2025-02-12 12:55:51 -05:00
<View
className="flex-row items-center justify-between bg-card border-b border-border"
style={{
paddingTop: Platform.OS === 'ios' ? insets.top : insets.top + 8,
paddingHorizontal: 16,
paddingBottom: 12,
}}
>
<View className="flex-1">
<Text className="text-2xl font-bold">{title}</Text>
{children}
</View>
{rightElement && (
<View className="ml-4">
{rightElement}
</View>
)}
2025-02-09 20:38:38 -05:00
</View>
);
}