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";
|
|
|
|
|
import { StyledImage } from "../StyledImage";
|
|
|
|
|
import { StyledLottie } from "./styled-lottie/StyledLottie";
|
2024-03-27 20:36:03 +05:30
|
|
|
import { StyledText } from "./styled-text/StyledText";
|
2024-05-14 23:40:14 +05:30
|
|
|
import Colors from "../../assets/colors/colors";
|
2024-03-27 20:36:03 +05:30
|
|
|
|
|
|
|
|
const TitleWithAssetsWidget = ({
|
|
|
|
|
widgetData,
|
|
|
|
|
widgetStyle,
|
|
|
|
|
handleActions,
|
|
|
|
|
widgetIndex,
|
|
|
|
|
handleClick,
|
|
|
|
|
}: {
|
|
|
|
|
widgetData: TitleWithAssetsWidgetData;
|
|
|
|
|
widgetStyle: ViewStyle;
|
|
|
|
|
handleActions: (screenActionPayload?: GenericActionPayload) => void;
|
2024-05-14 23:40:14 +05:30
|
|
|
widgetIndex?: number;
|
2024-03-27 20:36:03 +05:30
|
|
|
handleClick?: (ctaData: CtaData) => void;
|
|
|
|
|
}) => {
|
|
|
|
|
return (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
2024-05-14 23:40:14 +05:30
|
|
|
handleClick && widgetData?.cta && handleClick(widgetData?.cta);
|
2024-03-27 20:36:03 +05:30
|
|
|
}}
|
|
|
|
|
activeOpacity={1}
|
|
|
|
|
>
|
2024-05-14 23:40:14 +05:30
|
|
|
<View
|
|
|
|
|
style={
|
|
|
|
|
widgetData?.titleStyle ? widgetData?.titleStyle : styles.container
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{widgetData?.leftIcon && (
|
|
|
|
|
<View>
|
|
|
|
|
<StyledImage imageFieldData={widgetData?.leftIcon} />
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
{widgetData?.leftLottie && (
|
|
|
|
|
<View>
|
|
|
|
|
<StyledLottie lottieFieldData={widgetData?.leftLottie} />
|
|
|
|
|
</View>
|
2024-03-27 20:36:03 +05:30
|
|
|
)}
|
2024-05-14 23:40:14 +05:30
|
|
|
{widgetData?.title && (
|
|
|
|
|
<View>
|
|
|
|
|
<StyledText textFieldData={widgetData?.title} />
|
|
|
|
|
</View>
|
2024-03-27 20:36:03 +05:30
|
|
|
)}
|
2024-05-14 23:40:14 +05:30
|
|
|
{widgetData?.rightIcon && (
|
|
|
|
|
<View>
|
|
|
|
|
<StyledImage imageFieldData={widgetData?.rightIcon} />
|
|
|
|
|
</View>
|
2024-03-27 20:36:03 +05:30
|
|
|
)}
|
2024-05-14 23:40:14 +05:30
|
|
|
{widgetData?.rightLottie && (
|
|
|
|
|
<View>
|
|
|
|
|
<StyledLottie lottieFieldData={widgetData?.rightLottie} />
|
|
|
|
|
</View>
|
2024-03-27 20:36:03 +05:30
|
|
|
)}
|
|
|
|
|
</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;
|