@pushchain/ui-kit
Version:
## Overview
29 lines • 1.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TogglePushWalletButton = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const usePushWallet_1 = require("../../hooks/usePushWallet");
const common_1 = require("../common");
const helpers_1 = require("../../helpers");
const constants_1 = require("../../constants");
const TogglePushWalletButton = ({ uid, universalAccount, }) => {
const { setMinimiseWallet, isWalletMinimised, toggleButtonRef } = (0, usePushWallet_1.usePushWalletContext)(uid);
const { chain, address } = universalAccount;
function getChainIcon(chain) {
const chainId = (0, helpers_1.getChainId)(chain);
if (!chainId) {
return (0, jsx_runtime_1.jsx)(common_1.PushMonotone, {});
}
const IconComponent = constants_1.CHAIN_LOGO[chainId];
if (IconComponent) {
return (0, jsx_runtime_1.jsx)(IconComponent, {});
}
else {
return (0, jsx_runtime_1.jsx)(common_1.PushMonotone, {});
}
}
const maskedAddress = (0, helpers_1.centerMaskString)(address);
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(common_1.Button, { onClick: () => setMinimiseWallet(!isWalletMinimised), bgColor: "var(--pwauth-btn-connected-bg-color)", textColor: "var(--pwauth-btn-connected-text-color)", borderRadius: "var(--pwauth-btn-connect-border-radius)", gap: '8px', padding: '12px', ref: toggleButtonRef, children: [getChainIcon(chain), maskedAddress] }) }));
};
exports.TogglePushWalletButton = TogglePushWalletButton;
//# sourceMappingURL=TogglePushWalletButton.js.map