Skip to content

Commit 86a643b

Browse files
committed
refactor activity table
1 parent 55d1bfa commit 86a643b

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

src/pages/network/common/ActivityTable.jsx

+37-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import copy from "clipboard-copy";
12
import { format } from "date-fns";
23
import { ethers } from "ethers";
34
import styled from "styled-components";
45
import toFlexible from "toflexible";
56

7+
import CopyIconImg from "@mybucks/assets/icons/copy.svg";
68
import { Box as BaseBox } from "@mybucks/components/Containers";
79
import Link from "@mybucks/components/Link";
810
import { H3 } from "@mybucks/components/Texts";
@@ -15,10 +17,18 @@ const Box = styled(BaseBox)`
1517

1618
const TableWrapper = styled.table`
1719
width: 100%;
18-
20+
font-size: ${({ theme }) => theme.sizes.base};
1921
td {
20-
padding-bottom: 4px;
22+
padding-bottom: ${({ theme }) => theme.sizes.x3s};
2123
}
24+
25+
${media.sm`
26+
font-size: ${({ theme }) => theme.sizes.sm};
27+
28+
a {
29+
font-size: ${({ theme }) => theme.sizes.sm};
30+
}
31+
`}
2232
`;
2333

2434
const AmountTd = styled.td`
@@ -27,9 +37,8 @@ const AmountTd = styled.td`
2737
`;
2838

2939
const AddressTd = styled.td`
30-
${media.sm`
31-
display: none;
32-
`}
40+
display: flex;
41+
align-items: center;
3342
`;
3443

3544
const AddressLinkLg = styled(Link)`
@@ -47,6 +56,15 @@ const AddressLink = styled(Link)`
4756
`}
4857
`;
4958

59+
const CopyButton = styled.img.attrs({
60+
alt: "Copy",
61+
src: CopyIconImg,
62+
})`
63+
cursor: pointer;
64+
margin-left: ${({ theme }) => theme.sizes.xs};
65+
width: ${({ theme }) => theme.sizes.sm};
66+
`;
67+
5068
const ActivityTable = ({ account, history }) => (
5169
<Box>
5270
<H3>Activity</H3>
@@ -73,9 +91,22 @@ const ActivityTable = ({ account, history }) => (
7391
target="_blank"
7492
>
7593
{truncate(
76-
item.transferType === "IN" ? item.fromAddress : item.toAddress
94+
item.transferType === "IN"
95+
? item.fromAddress
96+
: item.toAddress,
97+
8
7798
)}
7899
</AddressLink>
100+
101+
<CopyButton
102+
onClick={() =>
103+
copy(
104+
item.transferType === "IN"
105+
? item.fromAddress
106+
: item.toAddress
107+
)
108+
}
109+
/>
79110
</AddressTd>
80111
<AmountTd $in={item.transferType === "IN"}>
81112
{item.transferType === "IN" ? "+" : "-"}&nbsp;

0 commit comments

Comments
 (0)