Skip to content

Commit 763370d

Browse files
authored
Merge pull request #8527 from ethereum/source-info
Adds source info for staking metrics
2 parents 8a31c7e + 3dc75df commit 763370d

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
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>

src/components/StatsBoxGrid.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ const Grid = styled.div`
6262
}
6363
`
6464

65-
const Box = styled.div<{
66-
color?: string
67-
}>`
65+
const Box = styled.div`
6866
position: relative;
6967
color: ${({ theme }) => theme.colors.text};
7068
height: 20rem;
@@ -111,14 +109,12 @@ const Lines = styled.div`
111109

112110
const ButtonContainer = styled.div<{ dir?: Direction }>`
113111
position: absolute;
114-
${({ dir }) => (dir === "rtl" ? "left:" : "right:")} 20px;
112+
${({ dir }) => (dir === "rtl" ? "left" : "right")}: 20px;
115113
bottom: 20px;
116114
font-family: ${(props) => props.theme.fonts.monospace};
117115
`
118116

119-
const Button = styled.button<{
120-
color: string
121-
}>`
117+
const Button = styled.button<{ color: string }>`
122118
background: ${(props) => props.theme.colors.background};
123119
font-family: ${(props) => props.theme.fonts.monospace};
124120
font-size: 1.25rem;
@@ -134,9 +130,7 @@ const Button = styled.button<{
134130
}
135131
`
136132

137-
const ButtonToggle = styled(Button)<{
138-
active: boolean
139-
}>`
133+
const ButtonToggle = styled(Button)<{ active: boolean }>`
140134
${({ active, theme }) =>
141135
active &&
142136
`

0 commit comments

Comments
 (0)