From 69c4be53a7b9a10b8497238683a14c73caa3a7c7 Mon Sep 17 00:00:00 2001
From: Gustavo Mauricio
Date: Thu, 15 Sep 2022 07:55:40 +0100
Subject: [PATCH] refactor: wallet buttons extracted to Button component
---
components/Button.tsx | 22 ++++++++++++++++++++++
components/Wallet.tsx | 19 ++++++++-----------
2 files changed, 30 insertions(+), 11 deletions(-)
create mode 100644 components/Button.tsx
diff --git a/components/Button.tsx b/components/Button.tsx
new file mode 100644
index 00000000..e17d3e43
--- /dev/null
+++ b/components/Button.tsx
@@ -0,0 +1,22 @@
+import React from "react";
+
+type Props = {
+ children: string;
+ className?: string;
+ onClick: () => void;
+};
+
+const Button = React.forwardRef(
+ ({ children, className = "", onClick }, ref) => (
+
+ )
+);
+
+Button.displayName = "Button";
+export default Button;
diff --git a/components/Wallet.tsx b/components/Wallet.tsx
index ce65dfd7..c702a050 100644
--- a/components/Wallet.tsx
+++ b/components/Wallet.tsx
@@ -3,11 +3,11 @@ import { Popover } from "@headlessui/react";
import { toast } from "react-toastify";
import Image from "next/image";
-import { formatWalletAddress } from "utils/formatters";
-
+import Button from "./Button";
import ConnectModal from "./ConnectModal";
import useWalletStore from "stores/useWalletStore";
import useInjectiveBalance from "hooks/useInjectiveBalance";
+import { formatWalletAddress } from "utils/formatters";
const WalletPopover = ({ children }: { children: React.ReactNode }) => {
const address = useWalletStore((state) => state.address);
@@ -17,7 +17,7 @@ const WalletPopover = ({ children }: { children: React.ReactNode }) => {
return (
-
+
{children}
@@ -33,12 +33,12 @@ const WalletPopover = ({ children }: { children: React.ReactNode }) => {
-
+
{address}