Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use updated error state icons in authCard #986

Merged
merged 12 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const ConnectionError = ({
return (
<div className="flex flex-col justify-center content-center gap-3">
<div className="flex justify-center">
<div className="w-[140px] h-[140px]">{getFailedIcon}</div>
<div className="w-[48px] h-[48px]">{getFailedIcon}</div>
</div>
<h2 className="font-semibold text-lg text-center">{getHeadingText}</h2>
<p className="text-sm text-center text-fg-secondary">{getBodyText}</p>
Expand All @@ -69,7 +69,7 @@ export const ConnectionError = ({
<Button
onClick={handleUseAnotherMethod}
variant={"social"}
className="border-0 hover:shadow-none"
className="border-0 bg-btn-secondary"
>
{ls.error.cta.useAnotherMethod}
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { CoinbaseWallet } from "../../../../../icons/coinbaseWallet.js";
import { EOAConnectionFailed } from "../../../../../icons/EOAConnectionFailed.js";
import { MetaMask } from "../../../../../icons/metamask.js";
import { WalletConnectIcon } from "../../../../../icons/walletConnectIcon.js";
import { EOAWallets } from "../types.js";
import { walletTypeConfig } from "../connection-error.js";
import { ConnectionFailed } from "../../../../../icons/connectionFailed.js";
Expand All @@ -12,18 +9,7 @@ export const WalletIcon = ({ walletType }: { walletType: EOAWallets }) => {
if (availableWallets.includes(walletType)) {
return (
iykazrji marked this conversation as resolved.
Show resolved Hide resolved
<div className="relative">
<EOAConnectionFailed />
<div className="absolute top-0 left-0 w-full h-full flex items-center justify-center z-[1]">
{walletType === EOAWallets.METAMASK && (
<MetaMask className="w-[35px] h-[35px]" />
)}
{walletType === EOAWallets.WALLET_CONNECT && (
<WalletConnectIcon className="w-[25px] h-[25px]" />
)}
{walletType === EOAWallets.COINBASE_WALLET && (
<CoinbaseWallet className="w-[35px] h-[35px]" />
)}
</div>
<EOAConnectionFailed walletType={walletType} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion account-kit/react/src/components/auth/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const AuthCardContent = ({
<div className="relative">
{/* Wrapper container that sizes its height dynamically */}
<div
className="transition-all duration-300 ease-out overflow-y-hidden"
className="transition-all duration-300 ease-out overflow-y-hidden radius-2"
style={{ height: height ? `${height}px` : "auto" }}
>
<div className="z-[1]" ref={contentRef}>
Expand Down
23 changes: 22 additions & 1 deletion account-kit/react/src/components/auth/card/loading/passkey.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
import { ls } from "../../../../strings.js";
import { LoadingPasskey } from "../../../../icons/passkey.js";
import { useAuthContext, type AuthStep } from "../../context.js";
import { ConnectionError } from "../error/connection-error.js";

interface LoadingPasskeyAuthProps {
authStep: Extract<AuthStep, { type: "passkey_verify" }>;
}
// eslint-disable-next-line jsdoc/require-jsdoc
export const LoadingPasskeyAuth = () => {
export const LoadingPasskeyAuth = ({ authStep }: LoadingPasskeyAuthProps) => {
const { setAuthStep } = useAuthContext();

if (authStep.error) {
return (
<ConnectionError
connectionType="passkey"
handleTryAgain={() =>
setAuthStep({
type: "initial",
})
}
handleUseAnotherMethod={() => setAuthStep({ type: "initial" })}
/>
);
}

return (
<div className="flex flex-col gap-5 items-center">
<div className="flex flex-col items-center justify-center">
Expand Down
2 changes: 1 addition & 1 deletion account-kit/react/src/components/auth/card/steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Step = () => {
case "email_verify":
return <LoadingEmail authStep={authStep} />;
case "passkey_verify":
return <LoadingPasskeyAuth />;
return <LoadingPasskeyAuth authStep={authStep} />;
case "email_completing":
return <CompletingEmailAuth authStep={authStep} />;
case "passkey_create":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const RenderFooterText = ({ authStep }: FooterProps) => {
};
export const Footer = ({ authStep }: FooterProps) => {
return (
<div className="bg-bg-surface-subtle p-5 border-bg-surface-inset border-t-[1px]">
<div className="p-5 pt-2">
<RenderFooterText authStep={authStep} />
<div className="flex justify-center">
<PoweredBy />
Expand Down
12 changes: 10 additions & 2 deletions account-kit/react/src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ export const Navigation = ({
variant="link"
onClick={onBack}
disabled={!showBack}
className={showBack ? "text-fg-secondary" : "invisible"}
className={
showBack
? "text-fg-secondary w-[32px] h-[32px] flex items-center justify-center hover:bg-btn-secondary rounded-md transition-all ease-out duration-200"
: "invisible"
}
>
<BackArrow />
</Button>

<Button
variant="link"
onClick={onClose}
className={showClose ? "text-fg-secondary" : "invisible"}
className={
showClose
? "text-fg-secondary w-[32px] h-[32px] flex items-center justify-center hover:bg-btn-secondary rounded-md transition-all ease-out duration-200"
: "invisible"
}
>
<X />
</Button>
Expand Down
Loading
Loading