@web3auth/modal
Version:
Multi chain wallet aggregator for web3Auth
54 lines (50 loc) • 1.65 kB
JavaScript
;
var jsxRuntime = require('react/jsx-runtime');
var auth = require('@web3auth/auth');
var utils = require('../../../utils.js');
var Image = require('../../Image/Image.js');
function getProviderIcon(method, isDark, isPrimaryBtn) {
const imageId = method === auth.AUTH_CONNECTION.TWITTER ? `login-X${isDark ? "-light" : "-dark"}` : `login-${method}${isDark ? "-light" : "-dark"}`;
const hoverId = method === auth.AUTH_CONNECTION.APPLE || method === auth.AUTH_CONNECTION.GITHUB || method === auth.AUTH_CONNECTION.TWITTER ? imageId : `login-${method}-active`;
if (isPrimaryBtn) {
return jsxRuntime.jsx(Image, {
width: "20",
imageId: hoverId,
hoverImageId: hoverId,
isButton: true
});
}
return jsxRuntime.jsx(Image, {
width: "20",
imageId: imageId,
hoverImageId: hoverId
});
}
function SocialLoginButton(props) {
const {
text,
showIcon,
showText,
method,
isDark,
isPrimaryBtn,
onClick,
children,
btnStyle,
buttonRadius = "pill"
} = props;
return jsxRuntime.jsxs("button", {
type: "button",
onClick: e => onClick && onClick(e),
className: utils.cn("w3a--btn", btnStyle, {
"w3a--rounded-full": buttonRadius === "pill",
"w3a--rounded-lg": buttonRadius === "rounded",
"w3a--rounded-none": buttonRadius === "square"
}),
children: [showIcon && getProviderIcon(method, isDark, isPrimaryBtn), showText && jsxRuntime.jsx("p", {
className: "w3a--text-sm w3a--font-normal w3a--text-app-gray-900 dark:w3a--text-app-white",
children: text
}), children]
});
}
module.exports = SocialLoginButton;