Skip to content

Commit e24087c

Browse files
committed
tiny chnages
1 parent 6eb23c7 commit e24087c

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

components/StakingCapBar.tsx

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ interface StakingCapBarProps {
55
height?: number
66
fillPercentage: number
77
secondFillPercentage: number
8-
labelText?: string
8+
firstFillLabel?: string
9+
secondFillLabel?: string
10+
totalLabel?: string
911
}
1012

1113
export default function StakingCapBar({
1214
totalLength = 300,
1315
height = 80,
1416
fillPercentage,
1517
secondFillPercentage,
16-
labelText
18+
firstFillLabel,
19+
secondFillLabel,
20+
totalLabel
1721
}: StakingCapBarProps) {
1822
// Ensure fillPercentages are between 0 and 100
1923
const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage))
@@ -23,7 +27,7 @@ export default function StakingCapBar({
2327
return (
2428
<div className="flex flex-col items-start">
2529
<div
26-
className="rounded overflow-hidden"
30+
className="rounded overflow-hidden relative"
2731
style={{
2832
width: `${totalLength}px`,
2933
height: `${height}px`,
@@ -37,24 +41,46 @@ export default function StakingCapBar({
3741
>
3842
<div className="flex h-full">
3943
<div
40-
className="h-full transition-all duration-300 ease-in-out"
44+
className="h-full transition-all duration-300 ease-in-out relative"
4145
style={{
4246
width: `${clampedFillPercentage}%`,
4347
backgroundColor: '#7142CF'
4448
}}
45-
></div>
49+
>
50+
{firstFillLabel && (
51+
<div
52+
className="absolute bottom-0 left-1/2 transform -translate-x-1/2 translate-y-full mt-1 text-xs font-medium text-gray-700 whitespace-nowrap"
53+
style={{
54+
transition: 'left 300ms ease-in-out'
55+
}}
56+
>
57+
{firstFillLabel}: {clampedFillPercentage}%
58+
</div>
59+
)}
60+
</div>
4661
<div
47-
className="h-full transition-all duration-300 ease-in-out"
62+
className="h-full transition-all duration-300 ease-in-out relative"
4863
style={{
4964
width: `${clampedSecondFillPercentage}%`,
50-
backgroundColor: '#E6DAFE'
65+
backgroundColor: '#7142CF'
5166
}}
52-
></div>
67+
>
68+
{secondFillLabel && (
69+
<div
70+
className="absolute bottom-0 left-1/2 transform -translate-x-1/2 translate-y-full mt-1 text-xs font-medium text-gray-700 whitespace-nowrap"
71+
style={{
72+
transition: 'left 300ms ease-in-out'
73+
}}
74+
>
75+
{secondFillLabel}: {clampedSecondFillPercentage}%
76+
</div>
77+
)}
78+
</div>
5379
</div>
5480
</div>
55-
{labelText && (
56-
<div className="mt-2 text-sm font-medium text-gray-700">
57-
{labelText}: {totalFillPercentage}%
81+
{totalLabel && (
82+
<div className="mt-6 text-sm font-medium text-gray-700">
83+
{totalLabel}: {totalFillPercentage}%
5884
</div>
5985
)}
6086
</div>

pages/home/oracle-integrity-staking/examples.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re
88

99
## Example 1: Only Publisher Stake
1010

11-
This example take the case one pool assigned where the publisher assigned has staked PYTH tokens, while the pool has no tokens delegated to it.
11+
This example take the case one pool where the pool has stake from only the publisher.
12+
1213

1314
$$
1415
\begin{aligned}
@@ -25,6 +26,8 @@ $$
2526
\end{aligned}
2627
$$
2728

29+
<StakingCapBar fillPercentage={100} labelText="100" secondFillPercentage={0} secondFillLabel="0" totalLabel="50"/>
30+
2831
## Example 2: Publisher and Delegator Stake
2932

3033
This example take the case where the pool has stake from both the publisher and the delegator.

0 commit comments

Comments
 (0)