Skip to content

Commit

Permalink
feat: add prop to disable magic link (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum authored Oct 7, 2024
1 parent d17366e commit 2857edd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ export type WalletModalProps = {
| "borderRadius"
| "onOptionClick"
> & { iconBorderRadius: CSSProperties["borderRadius"] };
withMagicLogin?: boolean;
};
export function WalletModal({
PrivacyPolicy,
magicLoginButtonProps,
optionProps
optionProps,
withMagicLogin = true
}: WalletModalProps) {
const chainId = useChainId();
const { config } = useConfigContext();
Expand Down Expand Up @@ -101,7 +103,7 @@ export function WalletModal({
/>
))}
</OptionGrid>
<MagicLoginButton {...magicLoginButtonProps} />
{withMagicLogin && <MagicLoginButton {...magicLoginButtonProps} />}
<PrivacyPolicy />
</AutoColumn>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function useSyncChainQuery() {
const parsedQs = useParsedQueryString();
const configIdRef = useRef(currentConfigId);
const accountRef = useRef(account);
const accountAlreadyConnected = useRef(account);
const accountAlreadyConnected = useRef<string | undefined>(account);
const disconnect = useCallback(() => {
accountAlreadyConnected.current = undefined;
_disconnect({ isUserDisconnecting: false });
Expand Down
4 changes: 4 additions & 0 deletions packages/react-kit/src/stories/ConnectWallet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const Component = ({
walletHoverColor,
magicLoginButtonThemeKey,
magicLoginButtonBorderRadiusPx,
withMagicLogin,
onUserDisconnect
}: {
showStatusIcon: boolean;
Expand All @@ -85,6 +86,7 @@ const Component = ({
walletHoverColor: string | undefined;
magicLoginButtonThemeKey: string | undefined;
magicLoginButtonBorderRadiusPx: string | undefined;
withMagicLogin: boolean | undefined;
onUserDisconnect: () => unknown;
}) => {
return (
Expand Down Expand Up @@ -175,6 +177,7 @@ const Component = ({
disconnectColor={accountDrawerDisconnectColor}
onUserDisconnect={onUserDisconnect}
walletModalProps={{
withMagicLogin,
optionProps: {
backgroundColor: walletBackgroundColor,
color: walletColor,
Expand Down Expand Up @@ -305,6 +308,7 @@ export const CustomTheme = {
walletHoverColor: "#ff0000",
magicLoginButtonThemeKey: "orangeInverse",
magicLoginButtonBorderRadiusPx: "50",
withMagicLogin: true,
showStatusIcon: false,
connectWalletChild: <>Connect</>,
rightConnectedChild: <Wallet />
Expand Down

0 comments on commit 2857edd

Please sign in to comment.