68 lines
1.4 KiB
TypeScript
68 lines
1.4 KiB
TypeScript
import React from "react";
|
|
import {
|
|
View,
|
|
Text,
|
|
TouchableOpacity,
|
|
StyleSheet,
|
|
ViewStyle,
|
|
StyleProp,
|
|
} from "react-native";
|
|
import { useTheme } from "../contexts/ThemeContext";
|
|
|
|
interface SectionHeaderProps {
|
|
title: string;
|
|
subtitle?: string;
|
|
actionLabel?: string;
|
|
onActionPress?: () => void;
|
|
style?: StyleProp<ViewStyle>;
|
|
}
|
|
|
|
export function SectionHeader({
|
|
title,
|
|
subtitle,
|
|
actionLabel,
|
|
onActionPress,
|
|
style,
|
|
}: SectionHeaderProps) {
|
|
const { colors, typography } = useTheme();
|
|
|
|
return (
|
|
<View style={[styles.container, style]}>
|
|
<View style={styles.textContainer}>
|
|
<Text style={[typography.h2, { color: colors.textPrimary }]}>
|
|
{title}
|
|
</Text>
|
|
{subtitle && (
|
|
<Text
|
|
style={[
|
|
typography.caption,
|
|
{ color: colors.textTertiary, marginTop: 4 },
|
|
]}
|
|
>
|
|
{subtitle}
|
|
</Text>
|
|
)}
|
|
</View>
|
|
{actionLabel && onActionPress && (
|
|
<TouchableOpacity onPress={onActionPress} activeOpacity={0.7}>
|
|
<Text style={[typography.bodyEmphasis, { color: colors.primary }]}>
|
|
{actionLabel}
|
|
</Text>
|
|
</TouchableOpacity>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flexDirection: "row",
|
|
justifyContent: "space-between",
|
|
alignItems: "center",
|
|
marginBottom: 16,
|
|
},
|
|
textContainer: {
|
|
flex: 1,
|
|
},
|
|
});
|