Simplify layout code

This commit is contained in:
Willian Mitsuda 2022-08-30 19:12:40 -03:00
parent 8a5fca753e
commit 94146d9004
No known key found for this signature in database
2 changed files with 38 additions and 40 deletions

View File

@ -26,13 +26,13 @@ const Home: React.FC = () => {
document.title = "Home | Otterscan"; document.title = "Home | Otterscan";
return ( return (
<div className="mx-auto flex flex-col grow pb-5"> <div className="flex flex-col items-center grow pb-5">
{isScanning && <CameraScanner turnOffScan={() => setScanning(false)} />} {isScanning && <CameraScanner turnOffScan={() => setScanning(false)} />}
<div className="m-5 mb-10 flex items-end grow max-h-64"> <div className="grow mt-5 mb-10 max-h-64 flex items-end">
<Logo /> <Logo />
</div> </div>
<form <form
className="flex flex-col" className="flex flex-col w-1/3"
onSubmit={handleSubmit} onSubmit={handleSubmit}
autoComplete="off" autoComplete="off"
spellCheck={false} spellCheck={false}
@ -65,46 +65,44 @@ const Home: React.FC = () => {
Search Search
</button> </button>
</form> </form>
<div className="mx-auto h-32"> <div className="text-lg text-link-blue hover:text-link-blue-hover font-bold">
<div className="text-lg text-link-blue hover:text-link-blue-hover font-bold"> {provider?.network.chainId !== 11155111 && (
{provider?.network.chainId !== 11155111 && ( <NavLink to="/special/london">
<NavLink to="/special/london"> <div className="flex space-x-2 items-baseline text-orange-500 hover:text-orange-700 hover:underline">
<div className="flex space-x-2 items-baseline text-orange-500 hover:text-orange-700 hover:underline"> <span>
<span> <FontAwesomeIcon icon={faBurn} />
<FontAwesomeIcon icon={faBurn} /> </span>
</span> <span>Check out the special dashboard for EIP-1559</span>
<span>Check out the special dashboard for EIP-1559</span> <span>
<span> <FontAwesomeIcon icon={faBurn} />
<FontAwesomeIcon icon={faBurn} />
</span>
</div>
</NavLink>
)}
</div>
{latestBlock && (
<NavLink
className="flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500 hover:text-link-blue"
to={blockURL(latestBlock.number)}
>
<div>Latest block: {commify(latestBlock.number)}</div>
<Timestamp value={latestBlock.timestamp} />
</NavLink>
)}
{beaconData && (
<div className="flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500">
<div>
Finalized slot: {commify(beaconData.data.header.message.slot)}
</div>
{slotTime && <Timestamp value={slotTime} />}
<div>
State root:{" "}
<span className="font-hash">
{beaconData.data.header.message.state_root}
</span> </span>
</div> </div>
</div> </NavLink>
)} )}
</div> </div>
{latestBlock && (
<NavLink
className="flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500 hover:text-link-blue"
to={blockURL(latestBlock.number)}
>
<div>Latest block: {commify(latestBlock.number)}</div>
<Timestamp value={latestBlock.timestamp} />
</NavLink>
)}
{beaconData && (
<div className="flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500">
<div>
Finalized slot: {commify(beaconData.data.header.message.slot)}
</div>
{slotTime && <Timestamp value={slotTime} />}
<div>
State root:{" "}
<span className="font-hash">
{beaconData.data.header.message.state_root}
</span>
</div>
</div>
)}
</div> </div>
); );
}; };

View File

@ -2,7 +2,7 @@ import React from "react";
import Otter from "./otter.jpg"; import Otter from "./otter.jpg";
const Logo: React.FC = () => ( const Logo: React.FC = () => (
<div className="mx-auto text-6xl text-link-blue font-title font-bold cursor-default flex items-center space-x-4"> <div className="text-6xl text-link-blue font-title font-bold cursor-default flex items-center justify-center space-x-4">
<img <img
className="rounded-full" className="rounded-full"
src={Otter} src={Otter}