Files
fitaiProto/apps/mobile/src/components/SectionHeader.tsx
T
dimitar 5d6166df1b redesign take 2 complete
fix artefacts from previous dessign
2026-03-12 17:56:46 +01:00

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,
},
});