import { ColorsStatus } from "@/constants/ColorsStatus"; import Styles from "@/constants/Styles"; import { useTheme } from "@/providers/ThemeProvider"; import React, { useState } from "react"; import { Dimensions, Pressable, View } from "react-native"; import Text from "./Text"; type Props = { title?: string subtitle?: string | React.ReactNode icon: React.ReactNode desc?: string rightTopInfo?: string onPress?: () => void onLongPress?: () => void borderType: 'all' | 'bottom' | 'none' leftBottomInfo?: React.ReactNode | string rightBottomInfo?: React.ReactNode | string titleWeight?: 'normal' | 'bold' bgColor?: string descEllipsize?: boolean textColor?: string, colorPress?: boolean titleShowAll?: boolean } export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, onLongPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight, bgColor, descEllipsize, textColor, colorPress, titleShowAll }: Props) { const { colors } = useTheme(); const textColorFix = textColor ? textColor : colors.text; const [isTap, setIsTap] = useState(false); return ( setIsTap(true)} onPressOut={() => setIsTap(false)} style={({ pressed }) => [ borderType == 'bottom' ? [Styles.wrapItemBorderBottom, { borderBottomColor: colors.icon + '20' }] : borderType == 'all' ? [Styles.wrapItemBorderAll, { borderColor: colors.icon + '20' }] : Styles.wrapItemBorderNone, bgColor == "transparent" ? { backgroundColor: 'transparent' } : { backgroundColor: colors.card }, // efek warna saat ditekan (sementara) isTap && colorPress && { backgroundColor: colors.icon + '20' }, ]} > {icon} {title} { subtitle && typeof subtitle == "string" ? {subtitle} : {subtitle} } { rightTopInfo && {rightTopInfo} } {desc && {desc}} { (leftBottomInfo || rightBottomInfo) && ( { typeof leftBottomInfo == 'string' ? {leftBottomInfo} : leftBottomInfo } { typeof rightBottomInfo == 'string' ? {rightBottomInfo} : rightBottomInfo } ) } ) }