blockiesui
Version:
A UI library for Blockies
23 lines (20 loc) • 2.47 kB
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../UI/dropdownMenu.js';
import { Button } from '../UI/button.js';
import { useWallet } from '../../hooks/useWallet.js';
import Wallet from '../../node_modules/.pnpm/lucide-react@0.483.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/wallet.js';
import ChevronDown from '../../node_modules/.pnpm/lucide-react@0.483.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
import Copy from '../../node_modules/.pnpm/lucide-react@0.483.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/copy.js';
import ExternalLink from '../../node_modules/.pnpm/lucide-react@0.483.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/external-link.js';
import LogOut from '../../node_modules/.pnpm/lucide-react@0.483.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/log-out.js';
function WalletDropdown() {
var _a = useWallet(), address = _a.address, isConnected = _a.isConnected, disconnect = _a.disconnect, truncateAddress = _a.truncateAddress;
if (!isConnected)
return null;
return (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs(Button, { className: "h-12 w-[220px] justify-between rounded-xl bg-gradient-to-r from-[#F27405] to-[#FF9F45] font-mono text-base font-bold text-white shadow-lg transition-all duration-300 hover:from-[#D66400] hover:to-[#F27405] hover:shadow-xl", children: [jsx(Wallet, { className: "mr-2 h-4 w-4" }), truncateAddress(address), jsx(ChevronDown, { className: "ml-2 h-4 w-4" })] }) }), jsxs(DropdownMenuContent, { className: "w-56 rounded-lg border border-orange-100 bg-white/90 p-1 shadow-lg backdrop-blur-sm dark:border-zinc-800 dark:bg-zinc-900", children: [jsxs(DropdownMenuItem, { onClick: function () {
void navigator.clipboard.writeText(address);
console.log("Address copied!");
}, children: [jsx(Copy, { className: "mr-2 h-4 w-4" }), " Copy Address"] }), jsxs(DropdownMenuItem, { children: [jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " View on Explorer"] }), jsxs(DropdownMenuItem, { onClick: function () { return disconnect(); }, className: "text-red-500", children: [jsx(LogOut, { className: "mr-2 h-4 w-4" }), " Disconnect"] })] })] }));
}
export { WalletDropdown as default };
//# sourceMappingURL=walletDropdown.js.map