New gauge style
This commit is contained in:
parent
c7b36152a8
commit
1e34e7fc8d
34
src/components/PercentageGauge.tsx
Normal file
34
src/components/PercentageGauge.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
type PercentageGaugeProps = {
|
||||||
|
perc: number;
|
||||||
|
bgFull: string;
|
||||||
|
bgPerc: string;
|
||||||
|
textPerc: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const PercentageGauge: React.FC<PercentageGaugeProps> = ({
|
||||||
|
perc,
|
||||||
|
bgFull,
|
||||||
|
bgPerc,
|
||||||
|
textPerc,
|
||||||
|
}) => (
|
||||||
|
<div className="w-60 h-6 border-l-2 border-gray-400 relative">
|
||||||
|
<div className="flex absolute w-full h-full">
|
||||||
|
<div className={`my-auto h-5 rounded-r-lg w-full ${bgFull}`}></div>
|
||||||
|
</div>
|
||||||
|
<div className="flex absolute w-full h-full">
|
||||||
|
<div
|
||||||
|
className={`my-auto h-5 rounded-r-lg ${bgPerc}`}
|
||||||
|
style={{ width: `${perc}%` }}
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`flex absolute w-full h-full mix-blend-multiply text-sans ${textPerc}`}
|
||||||
|
>
|
||||||
|
<span className="m-auto">{perc}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default React.memo(PercentageGauge);
|
@ -1,12 +1,9 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import {
|
import { faBurn, faCoins } from "@fortawesome/free-solid-svg-icons";
|
||||||
faAngleRight,
|
|
||||||
faBurn,
|
|
||||||
faCoins,
|
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import FormattedBalance from "../components/FormattedBalance";
|
import FormattedBalance from "../components/FormattedBalance";
|
||||||
import { TransactionData } from "../types";
|
import { TransactionData } from "../types";
|
||||||
|
import PercentageGauge from "../components/PercentageGauge";
|
||||||
|
|
||||||
type RewardSplitProps = {
|
type RewardSplitProps = {
|
||||||
txData: TransactionData;
|
txData: TransactionData;
|
||||||
@ -20,25 +17,15 @@ const RewardSplit: React.FC<RewardSplitProps> = ({ txData }) => {
|
|||||||
100;
|
100;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-2">
|
<div className="inline-block">
|
||||||
<div
|
<div className="grid grid-cols-2 gap-x-2 gap-y-1 items-center text-sm">
|
||||||
className="self-center w-40 border rounded border-gray-200"
|
<PercentageGauge
|
||||||
title="Burnt Fees Percentage"
|
perc={burntPerc}
|
||||||
>
|
bgFull="bg-orange-100"
|
||||||
<div className="w-full h-5 rounded bg-orange-500 relative">
|
bgPerc="bg-orange-500"
|
||||||
<div
|
textPerc="text-orange-800"
|
||||||
className="absolute top-0 right-0 bg-yellow-200 h-full rounded-r"
|
/>
|
||||||
style={{ width: `${100 - burntPerc}%` }}
|
<div className="flex items-baseline space-x-1">
|
||||||
></div>
|
|
||||||
<div className="w-full h-full absolute flex mix-blend-multiply text-sans text-orange-800">
|
|
||||||
<span className="m-auto">{burntPerc}%</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-baseline space-x-1 text-sm">
|
|
||||||
<span className="text-gray-500">
|
|
||||||
<FontAwesomeIcon icon={faAngleRight} size="1x" />
|
|
||||||
</span>
|
|
||||||
<span className="flex space-x-1 text-orange-500">
|
<span className="flex space-x-1 text-orange-500">
|
||||||
<span title="Burnt fees">
|
<span title="Burnt fees">
|
||||||
<FontAwesomeIcon icon={faBurn} size="1x" />
|
<FontAwesomeIcon icon={faBurn} size="1x" />
|
||||||
@ -51,10 +38,13 @@ const RewardSplit: React.FC<RewardSplitProps> = ({ txData }) => {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-baseline space-x-1 text-sm">
|
<PercentageGauge
|
||||||
<span className="text-gray-500">
|
perc={100 - burntPerc}
|
||||||
<FontAwesomeIcon icon={faAngleRight} size="1x" />
|
bgFull="bg-yellow-100"
|
||||||
</span>
|
bgPerc="bg-yellow-300"
|
||||||
|
textPerc="text-yellow-700"
|
||||||
|
/>
|
||||||
|
<div className="flex items-baseline space-x-1">
|
||||||
<span className="flex space-x-1">
|
<span className="flex space-x-1">
|
||||||
<span className="text-yellow-300" title="Miner fees">
|
<span className="text-yellow-300" title="Miner fees">
|
||||||
<FontAwesomeIcon icon={faCoins} size="1x" />
|
<FontAwesomeIcon icon={faCoins} size="1x" />
|
||||||
@ -65,6 +55,7 @@ const RewardSplit: React.FC<RewardSplitProps> = ({ txData }) => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user