Files
mobile-darmasaba/components/paperGridContent.tsx
2025-07-28 10:15:27 +08:00

29 lines
1.2 KiB
TypeScript

import { ColorsStatus } from "@/constants/ColorsStatus";
import Styles from "@/constants/Styles";
import { Pressable, View } from "react-native";
import Text from "./Text";
type Props = {
content: 'carousel' | 'page';
children: React.ReactNode;
title: string
headerColor: 'primary' | 'warning'
onPress?: () => void
contentPosition?: 'top' | 'center'
titleTail?: number
};
export default function PaperGridContent({ content, children, title, headerColor, onPress, contentPosition, titleTail }: Props) {
return (
<Pressable onPress={onPress}>
<View style={[content == 'carousel' ? Styles.wrapGridCaraousel : Styles.wrapGridContent, headerColor == 'warning' ? ColorsStatus.warning : ColorsStatus.primary]}>
<View style={[Styles.headerPaperGrid]}>
<Text numberOfLines={titleTail ? titleTail : undefined} style={[Styles.textSubtitle, headerColor == 'warning' ? Styles.cDefault : Styles.cWhite, {textAlign: 'center' }]}>{title}</Text>
</View>
<View style={[contentPosition && contentPosition == 'top' ? Styles.contentPaperGrid2 : Styles.contentPaperGrid]}>
{children}
</View>
</View>
</Pressable>
)
}