2024-03-28 12:12:34 +05:30
|
|
|
import { StyleSheet, TouchableOpacity, View, ViewStyle } from "react-native";
|
2024-03-27 20:36:03 +05:30
|
|
|
import { GenericActionPayload } from "../../App/common/actions/GenericAction";
|
|
|
|
|
import { CtaData } from "../../App/common/interface";
|
2024-03-28 12:12:34 +05:30
|
|
|
import { TitleWithAssetsWidgetData } from "../../App/common/interface/widgets/widgetData/TitleWithAssetsWidgetData";
|
2024-03-27 20:36:03 +05:30
|
|
|
import Colors from "../../assets/colors/colors";
|
2024-03-28 12:12:34 +05:30
|
|
|
import { StyledImage } from "../StyledImage";
|
|
|
|
|
import { StyledLottie } from "./styled-lottie/StyledLottie";
|
2024-03-27 20:36:03 +05:30
|
|
|
import { StyledText } from "./styled-text/StyledText";
|
|
|
|
|
|
|
|
|
|
const TitleWithAssetsWidget = ({
|
|
|
|
|
widgetData,
|
|
|
|
|
widgetStyle,
|
|
|
|
|
handleActions,
|
|
|
|
|
widgetIndex,
|
|
|
|
|
handleClick,
|
|
|
|
|
}: {
|
|
|
|
|
widgetData: TitleWithAssetsWidgetData;
|
|
|
|
|
widgetStyle: ViewStyle;
|
|
|
|
|
handleActions: (screenActionPayload?: GenericActionPayload) => void;
|
|
|
|
|
widgetIndex: number;
|
|
|
|
|
handleClick?: (ctaData: CtaData) => void;
|
|
|
|
|
}) => {
|
|
|
|
|
return (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
handleClick && widgetData.cta && handleClick(widgetData.cta);
|
|
|
|
|
}}
|
|
|
|
|
activeOpacity={1}
|
|
|
|
|
>
|
|
|
|
|
<View style={styles.container}>
|
|
|
|
|
{widgetData.leftIcon && (
|
|
|
|
|
<StyledImage imageFieldData={widgetData?.leftIcon} />
|
|
|
|
|
)}
|
|
|
|
|
{widgetData.leftLottie && (
|
|
|
|
|
<StyledLottie lottieFieldData={widgetData?.leftLottie} />
|
|
|
|
|
)}
|
|
|
|
|
{widgetData.title && <StyledText textFieldData={widgetData?.title} />}
|
|
|
|
|
{widgetData.rightIcon && (
|
|
|
|
|
<StyledImage imageFieldData={widgetData?.rightIcon} />
|
|
|
|
|
)}
|
|
|
|
|
{widgetData.rightLottie && (
|
|
|
|
|
<StyledLottie lottieFieldData={widgetData?.rightLottie} />
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
|
container: {
|
|
|
|
|
flexDirection: "row",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
borderColor: Colors.hawkesBlue,
|
|
|
|
|
borderRadius: 32,
|
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
|
paddingVertical: 9,
|
|
|
|
|
backgroundColor: Colors.powderBlue,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default TitleWithAssetsWidget;
|