Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
7c0c9329
Commit
7c0c9329
authored
May 29, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style it a little better with shadow and amount wrapped by color
parent
e91649a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
29 deletions
+42
-29
TransactionInformationsItem.tsx
src/components/TransactionInformationsItem.tsx
+42
-29
No files found.
src/components/TransactionInformationsItem.tsx
View file @
7c0c9329
...
@@ -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
width=
{
50
}
height=
{
50
}
borderRadius=
{
10
}
overflow=
{
"hidden"
}
>
<
Box
flexDirection=
{
"row"
}
flex=
{
1
}
gap=
{
"s"
}
>
{
/* <Image
<
Box
width=
{
50
}
height=
{
50
}
borderRadius=
{
10
}
overflow=
{
"hidden"
}
>
source={require("../../assets/operators/orange_money.png")}
<
PaymentOption
paymentMethod=
{
paymentType
}
onPress=
{
()
=>
{}
}
/>
style={images.cover}
</
Box
>
/> */
}
<
Box
height=
{
50
}
flex=
{
1
}
>
<
PaymentOption
paymentMethod=
{
paymentType
}
onPress=
{
()
=>
{}
}
/>
<
Text
variant=
{
"black"
}
>
{
reference
}
</
Text
>
<
Text
>
{
moment
(
dateObject
).
fromNow
()
}
</
Text
>
</
Box
>
</
Box
>
</
Box
>
<
Box
height=
{
50
}
flex=
{
1
}
>
<
Text
variant=
{
"black"
}
>
{
reference
}
</
Text
>
<
Box
height=
{
50
}
>
<
Text
>
{
moment
(
dateObject
).
fromNow
()
}
</
Text
>
</
Box
>
<
Box
style=
{
{
marginLeft
:
"auto"
}
}
height=
{
50
}
>
{
/* <Text variant={"softYellow"} fontWeight={"bold"}>
{amount}
</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"
>
{
amount
}
<
Text
variant=
{
"white"
}
fontWeight=
{
"bold"
}
>
</
Text
>
{
amount
}
</
Text
>
</
AmountWrapper
>
);
);
}
}
if
(
status
===
"INITIATED"
)
{
if
(
status
===
"INITIATED"
)
{
return
(
return
(
<
Text
variant=
{
"softYellow"
}
fontWeight=
{
"bold"
}
>
<
AmountWrapper
color=
"softYellow"
>
{
amount
}
<
Text
variant=
{
"white"
}
fontWeight=
{
"bold"
}
>
</
Text
>
{
amount
}
</
Text
>
</
AmountWrapper
>
);
);
}
}
return
(
return
(
<
Text
variant=
{
"softRed"
}
fontWeight=
{
"bold"
}
>
<
AmountWrapper
color=
"softRed"
>
{
amount
}
<
Text
variant=
{
"white"
}
fontWeight=
{
"bold"
}
>
</
Text
>
{
amount
}
</
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
>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment