Add transaction card component and provider (#5)

This commit is contained in:
Justin Starry
2020-03-17 12:04:04 +08:00
committed by Michael Vines
parent de1df895a0
commit 6006c30ace
5 changed files with 264 additions and 18 deletions

View File

@@ -0,0 +1,28 @@
import React from "react";
import { useNetwork, NetworkStatus } from "../providers/network";
function NetworkStatusButton() {
const { status, url } = useNetwork();
switch (status) {
case NetworkStatus.Connected:
return <span className="btn btn-white lift">{url}</span>;
case NetworkStatus.Connecting:
return (
<span className="btn btn-warning lift">
{"Connecting "}
<span
className="spinner-grow spinner-grow-sm text-dark"
role="status"
aria-hidden="true"
></span>
</span>
);
case NetworkStatus.Failure:
return <span className="btn btn-danger lift">Disconnected</span>;
}
}
export default NetworkStatusButton;