Add chart toggle button

This commit is contained in:
Willian Mitsuda 2021-08-04 16:05:22 -03:00
parent f9e3f71115
commit d6fed2fa4b
1 changed files with 16 additions and 9 deletions

View File

@ -39,7 +39,7 @@ const Blocks: React.FC<BlocksProps> = ({ latestBlock, targetBlockNumber }) => {
const { provider } = useContext(RuntimeContext);
const [blocks, setBlocks] = useState<ExtendedBlock[]>([]);
const [now, setNow] = useState<number>(Date.now());
const [toggleChart, setToggleChart] = useState<boolean>(false);
const [toggleChart, setToggleChart] = useState<boolean>(true);
const addBlock = useCallback(
async (blockNumber: number) => {
@ -106,14 +106,21 @@ const Blocks: React.FC<BlocksProps> = ({ latestBlock, targetBlockNumber }) => {
return (
<div className="w-full mb-auto">
<div className="px-9 pt-3 pb-12 divide-y-2">
<div className="flex justify-center items-baseline space-x-2 px-3 pb-2 text-lg text-orange-500 ">
<span>
<FontAwesomeIcon icon={faBurn} />
</span>
<span>EIP-1559 is activated. Watch the fees burn.</span>
<span>
<FontAwesomeIcon icon={faBurn} />
</span>
<div className="relative">
<div className="flex justify-center items-baseline space-x-2 px-3 pb-2 text-lg text-orange-500 ">
<span>
<FontAwesomeIcon icon={faBurn} />
</span>
<span>EIP-1559 is activated. Watch the fees burn.</span>
<span>
<FontAwesomeIcon icon={faBurn} />
</span>
</div>
<div className="absolute right-0 top-0 border rounded shadow-md px-2 py-1 text-sm text-link-blue hover:bg-gray-50 hover:text-link-blue-hover">
<button onClick={() => setToggleChart(!toggleChart)}>
{toggleChart ? "Gas usage" : "Burnt fees"}
</button>
</div>
</div>
<div>
<Line data={data} height={100} options={chartOptions} />