Skip to content

Commit d0fe1fa

Browse files
authored
Merge pull request #63 from andreMD287/develop
feat(wallet): add sidebar variant and fix connect/disconnect flow
2 parents 6ee39fe + e0831cc commit d0fe1fa

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

packages/tw-blocks-shared/src/wallet-kit/WalletButtons.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ import { useWalletContext } from "./WalletProvider";
66
import { Popover, PopoverContent, PopoverTrigger } from "@tokenization/ui/popover";
77
import { Check, Copy, LogOut, ChevronRight, Wallet } from "lucide-react";
88

9+
type WalletButtonProps = {
10+
/** Use "sidebar" for lighter styling inside a sidebar (no dark/black background) */
11+
variant?: "default" | "sidebar";
12+
};
13+
914
/**
1015
* Wallet connection/disconnection button component
1116
* Shows different states based on wallet connection status
1217
*/
13-
export const WalletButton = () => {
18+
export const WalletButton = ({ variant = "default" }: WalletButtonProps) => {
1419
const { handleConnect, handleDisconnect } = useWallet();
1520
const { walletAddress, walletName } = useWalletContext();
1621
const [copied, setCopied] = React.useState(false);
@@ -37,12 +42,17 @@ export const WalletButton = () => {
3742
}
3843
};
3944

40-
if (!mounted) {
45+
const connectButtonClass =
46+
variant === "sidebar"
47+
? "flex w-full items-center gap-2 rounded-xl px-3 h-12 border border-border bg-sidebar-accent text-sidebar-accent-foreground hover:bg-sidebar-accent/80 transition-colors font-medium text-sm cursor-pointer"
48+
: "flex w-full items-center gap-2 rounded-xl px-3 h-12 bg-primary text-primary-foreground hover:bg-primary/90 transition-colors font-medium text-sm cursor-pointer";
49+
50+
if (!mounted || !walletAddress) {
4151
return (
4252
<button
4353
type="button"
44-
onClick={mounted ? handleConnect : undefined}
45-
className="flex w-full items-center gap-2 rounded-xl px-3 h-12 bg-primary text-primary-foreground hover:bg-brand-primary-hover transition-colors font-medium text-sm cursor-pointer"
54+
onClick={handleConnect}
55+
className={connectButtonClass}
4656
>
4757
<Wallet className="size-5 shrink-0" />
4858
<span>Conectar Billetera</span>

packages/ui/src/sidebar-wallet-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function SidebarWalletButton() {
1515
isCollapsed && "justify-center"
1616
)}
1717
>
18-
<WalletButton />
18+
<WalletButton variant="sidebar" />
1919
</div>
2020
)
2121
}

0 commit comments

Comments
 (0)