Commit 7c0c9329 by G

style it a little better with shadow and amount wrapped by color

parent e91649a4
...@@ -16,37 +16,33 @@ interface Props { ...@@ -16,37 +16,33 @@ interface Props {
moment.locale("fr"); moment.locale("fr");
const TransactionInformationsItem = ({ paymentType, reference, date, amount, status }: Props) => { const TransactionInformationsItem = ({ paymentType, reference, date, amount, status }: Props) => {
// date = new Date(date);
const dateObject = Date.parse(date); const dateObject = Date.parse(date);
return ( return (
<Box <Box
// height={60}
width={"100%"} width={"100%"}
py={"s"} py={"s"}
pr={"m"} px={"s"}
pl={"s"}
flexDirection={"row"} flexDirection={"row"}
// alignItems={"center"}
gap={"s"} gap={"s"}
borderWidth={1}
borderRadius={10} borderRadius={10}
borderColor={"lightGray"} borderColor={"lightGray"}
shadowColor={"black"}
shadowOffset={{ width: 0, height: 0 }}
shadowOpacity={0.5}
backgroundColor={"white"}
justifyContent={"space-between"}
> >
<Box flexDirection={"row"} flex={1} gap={"s"}>
<Box width={50} height={50} borderRadius={10} overflow={"hidden"}> <Box width={50} height={50} borderRadius={10} overflow={"hidden"}>
{/* <Image
source={require("../../assets/operators/orange_money.png")}
style={images.cover}
/> */}
<PaymentOption paymentMethod={paymentType} onPress={() => {}} /> <PaymentOption paymentMethod={paymentType} onPress={() => {}} />
</Box> </Box>
<Box height={50} flex={1}> <Box height={50} flex={1}>
<Text variant={"black"}>{reference}</Text> <Text variant={"black"}>{reference}</Text>
<Text>{moment(dateObject).fromNow()}</Text> <Text>{moment(dateObject).fromNow()}</Text>
</Box> </Box>
<Box style={{ marginLeft: "auto" }} height={50}> </Box>
{/* <Text variant={"softYellow"} fontWeight={"bold"}>
{amount} <Box height={50}>
</Text> */}
<AmountColorRenderer status={status} amount={amount} /> <AmountColorRenderer status={status} amount={amount} />
</Box> </Box>
</Box> </Box>
...@@ -56,22 +52,39 @@ const TransactionInformationsItem = ({ paymentType, reference, date, amount, sta ...@@ -56,22 +52,39 @@ const TransactionInformationsItem = ({ paymentType, reference, date, amount, sta
const AmountColorRenderer = ({ status, amount }: { status: string; amount: number }) => { const AmountColorRenderer = ({ status, amount }: { status: string; amount: number }) => {
if (status === "SUCCESS") { if (status === "SUCCESS") {
return ( return (
<Text variant={"secondary"} fontWeight={"bold"}> <AmountWrapper color="secondary">
<Text variant={"white"} fontWeight={"bold"}>
{amount} {amount}
</Text> </Text>
</AmountWrapper>
); );
} }
if (status === "INITIATED") { if (status === "INITIATED") {
return ( return (
<Text variant={"softYellow"} fontWeight={"bold"}> <AmountWrapper color="softYellow">
<Text variant={"white"} fontWeight={"bold"}>
{amount} {amount}
</Text> </Text>
</AmountWrapper>
); );
} }
return ( return (
<Text variant={"softRed"} fontWeight={"bold"}> <AmountWrapper color="softRed">
<Text variant={"white"} fontWeight={"bold"}>
{amount} {amount}
</Text> </Text>
</AmountWrapper>
);
};
const AmountWrapper = ({
color,
children,
}: { color: "secondary" | "softYellow" | "softRed"; children: React.ReactNode }) => {
return (
<Box backgroundColor={color} px={"m"} py={"xs"} borderRadius={10}>
{children}
</Box>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment