From 16ffe567b69f34d0d2a17e61c1fb14dc0d5db297 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sun, 5 Sep 2021 17:39:11 -0300 Subject: [PATCH] Use headless-ui Tabs --- src/AddressTransactions.tsx | 126 ++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/src/AddressTransactions.tsx b/src/AddressTransactions.tsx index 1d124de..c5b96a5 100644 --- a/src/AddressTransactions.tsx +++ b/src/AddressTransactions.tsx @@ -1,4 +1,10 @@ -import React, { useState, useEffect, useMemo, useContext } from "react"; +import React, { + useState, + useEffect, + useMemo, + useContext, + Fragment, +} from "react"; import { useParams, useLocation, @@ -8,14 +14,14 @@ import { } from "react-router-dom"; import { BlockTag } from "@ethersproject/abstract-provider"; import { getAddress, isAddress } from "@ethersproject/address"; +import { Tab } from "@headlessui/react"; import queryString from "query-string"; import Blockies from "react-blockies"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import Copy from "./components/Copy"; import ContentFrame from "./ContentFrame"; -import TabGroup from "./components/TabGroup"; -import Tab from "./components/Tab"; +import CustomTab from "./components/Tab"; import Contracts from "./address/Contracts"; import UndefinedPageControl from "./search/UndefinedPageControl"; import ResultHeader from "./search/ResultHeader"; @@ -203,48 +209,23 @@ const AddressTransactions: React.FC = () => { )} - - Overview - - Contract - - - - - -
-
- {page === undefined ? ( - <>Waiting for search results... - ) : ( - <>{page.length} transactions on this page - )} -
- -
- - {controller ? ( - - {controller.getPage().map((tx) => ( - - ))} + + + + + Overview + + + + + Contract + + + + + + +
{page === undefined ? ( @@ -266,16 +247,51 @@ const AddressTransactions: React.FC = () => { feeDisplay={feeDisplay} feeDisplayToggler={feeDisplayToggler} /> - - ) : ( - - )} - - - - - - + {controller ? ( + + {controller.getPage().map((tx) => ( + + ))} +
+
+ {page === undefined ? ( + <>Waiting for search results... + ) : ( + <>{page.length} transactions on this page + )} +
+ +
+ +
+ ) : ( + + )} + + + + + + + + ) )}