Skip to content

Commit 3a52aee

Browse files
committed
add source info for staking stats
source: Beaconcha.in
1 parent 50f4abf commit 3a52aee

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/components/Staking/StakingStatsBox.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { useIntl } from "react-intl"
55
import { Spinner } from "@chakra-ui/react"
66
// Import components
77
import Translation from "../Translation"
8+
import Tooltip from "../Tooltip"
9+
import Link from "../Link"
10+
import Icon from "../Icon"
811
// Import utilities
912
import { Lang } from "../../utils/languages"
1013
import { getData } from "../../utils/cache"
@@ -49,12 +52,40 @@ const Value = styled.code`
4952
color: ${({ theme }) => theme.colors.primary};
5053
`
5154

52-
const Label = styled.p`
55+
const Label = styled.div`
56+
display: flex;
57+
flex-wrap: nowrap;
58+
align-items: center;
5359
text-transform: uppercase;
5460
font-size: 0.875rem;
5561
margin-top: 0.5rem;
5662
`
5763

64+
const StyledIcon = styled(Icon)`
65+
fill: ${({ theme }) => theme.colors.text};
66+
margin-inline-start: 0.5rem;
67+
@media (max-width: ${({ theme }) => theme.breakpoints.l}) {
68+
}
69+
&:hover,
70+
&:active,
71+
&:focus {
72+
fill: ${({ theme }) => theme.colors.primary};
73+
}
74+
`
75+
76+
const BeaconchainTooltip = () => (
77+
<Tooltip
78+
content={
79+
<div>
80+
<Translation id="data-provided-by" />{" "}
81+
<Link to="https://beaconcha.in">Beaconcha.in</Link>
82+
</div>
83+
}
84+
>
85+
<StyledIcon name="info" size="16" />
86+
</Tooltip>
87+
)
88+
5889
// Interfaces
5990
export interface IProps {}
6091

@@ -128,6 +159,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
128159
)}
129160
<Label>
130161
<Translation id="page-staking-stats-box-metric-1" />
162+
<BeaconchainTooltip />
131163
</Label>
132164
</Cell>
133165
<Cell>
@@ -140,6 +172,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
140172
)}
141173
<Label>
142174
<Translation id="page-staking-stats-box-metric-2" />
175+
<BeaconchainTooltip />
143176
</Label>
144177
</Cell>
145178
<Cell>
@@ -152,6 +185,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
152185
)}
153186
<Label>
154187
<Translation id="page-staking-stats-box-metric-3" />
188+
<BeaconchainTooltip />
155189
</Label>
156190
</Cell>
157191
</Container>

0 commit comments

Comments
 (0)