@web3auth/modal
Version:
Multi chain wallet aggregator for web3Auth
52 lines (49 loc) • 1.63 kB
JavaScript
import { AUTH_CONNECTION } from '@web3auth/auth';
import { cn } from '../../../utils.js';
import Image from '../../Image/Image.js';
import { jsxs, jsx } from 'react/jsx-runtime';
function getProviderIcon(method, isDark, isPrimaryBtn) {
const imageId = method === AUTH_CONNECTION.TWITTER ? `login-X${isDark ? "-light" : "-dark"}` : `login-${method}${isDark ? "-light" : "-dark"}`;
const hoverId = method === AUTH_CONNECTION.APPLE || method === AUTH_CONNECTION.GITHUB || method === AUTH_CONNECTION.TWITTER ? imageId : `login-${method}-active`;
if (isPrimaryBtn) {
return /*#__PURE__*/jsx(Image, {
width: "20",
imageId: hoverId,
hoverImageId: hoverId,
isButton: true
});
}
return /*#__PURE__*/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 /*#__PURE__*/jsxs("button", {
type: "button",
onClick: e => onClick && onClick(e),
className: 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 && /*#__PURE__*/jsx("p", {
className: "w3a--text-sm w3a--font-normal w3a--text-app-gray-900 dark:w3a--text-app-white",
children: text
}), children]
});
}
export { SocialLoginButton as default };