refactor(app): remove unused components
This commit is contained in:
@@ -8,7 +8,6 @@ import { AuthFacebookPanel } from "../auth-facebook-panel";
|
||||
import { AuthLegalText } from "../auth-legal-text";
|
||||
import { AuthPrimaryButton } from "../auth-primary-button";
|
||||
import { AuthSocialButton } from "../auth-social-button";
|
||||
import { AuthSocialButtons } from "../auth-social-buttons";
|
||||
import { AuthTextField } from "../auth-text-field";
|
||||
import { EmailLoginForm } from "../email-login-form";
|
||||
import { EmailRegisterForm } from "../email-register-form";
|
||||
@@ -86,24 +85,6 @@ describe("auth Tailwind components", () => {
|
||||
expect(html).toContain("Continue");
|
||||
});
|
||||
|
||||
it("renders AuthSocialButtons with provider-specific Tailwind styles", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<AuthSocialButtons
|
||||
onFacebook={() => {}}
|
||||
onGoogle={() => {}}
|
||||
onApple={() => {}}
|
||||
showApple
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("bg-facebook-blue");
|
||||
expect(html).toContain("bg-white");
|
||||
expect(html).toContain("bg-black");
|
||||
expect(html).toContain("Continue with Facebook");
|
||||
expect(html).toContain("Continue with Google");
|
||||
expect(html).toContain("Continue with Apple");
|
||||
});
|
||||
|
||||
it("renders AuthLegalText with Tailwind checkbox and links", () => {
|
||||
const html = renderToStaticMarkup(<AuthLegalText />);
|
||||
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
"use client";
|
||||
/**
|
||||
* 社交登录按钮组合
|
||||
*
|
||||
*
|
||||
*
|
||||
* 包含 Facebook / Google / Apple 三个按钮的竖排列表。
|
||||
*/
|
||||
import { type ReactNode } from "react";
|
||||
|
||||
import { AuthProviderIcon } from "./auth-provider-icon";
|
||||
|
||||
export interface AuthSocialButtonsProps {
|
||||
onFacebook: () => void;
|
||||
onGoogle: () => void;
|
||||
onApple?: () => void;
|
||||
loadingProvider?: "facebook" | "google" | "apple" | null;
|
||||
showApple?: boolean;
|
||||
/** 自定义子节点(如嵌入 GIS 按钮) */
|
||||
googleSlot?: ReactNode;
|
||||
}
|
||||
|
||||
export function AuthSocialButtons({
|
||||
onFacebook,
|
||||
onGoogle,
|
||||
onApple,
|
||||
loadingProvider,
|
||||
showApple = false,
|
||||
googleSlot,
|
||||
}: AuthSocialButtonsProps) {
|
||||
const buttonClassName =
|
||||
"inline-flex min-h-(--button-height) w-full cursor-pointer items-center justify-center gap-sm rounded-full border border-chat-input-border bg-[rgba(255,255,255,0.04)] px-lg text-(length:--responsive-body) font-medium text-text-primary transition-colors duration-150 enabled:hover:bg-[rgba(255,255,255,0.08)] disabled:cursor-not-allowed disabled:opacity-50";
|
||||
const iconClassName = "inline-flex size-5 items-center justify-center";
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-md">
|
||||
<button
|
||||
type="button"
|
||||
className={`${buttonClassName} border-transparent bg-facebook-blue`}
|
||||
onClick={onFacebook}
|
||||
disabled={loadingProvider !== null && loadingProvider !== "facebook"}
|
||||
>
|
||||
<span className={iconClassName} aria-hidden="true">
|
||||
<AuthProviderIcon provider="facebook" />
|
||||
</span>
|
||||
<span>Continue with Facebook</span>
|
||||
</button>
|
||||
|
||||
{googleSlot ? (
|
||||
<div className="flex min-h-(--button-height) w-full justify-center">
|
||||
{googleSlot}
|
||||
</div>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className={`${buttonClassName} border-transparent bg-white text-[#1f1f1f]`}
|
||||
onClick={onGoogle}
|
||||
disabled={loadingProvider !== null && loadingProvider !== "google"}
|
||||
>
|
||||
<span className={iconClassName} aria-hidden="true">
|
||||
<AuthProviderIcon provider="google" />
|
||||
</span>
|
||||
<span>Continue with Google</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{showApple && onApple ? (
|
||||
<button
|
||||
type="button"
|
||||
className={`${buttonClassName} border-[rgba(255,255,255,0.2)] bg-black text-white`}
|
||||
onClick={onApple}
|
||||
disabled={loadingProvider !== null && loadingProvider !== "apple"}
|
||||
>
|
||||
<span className={iconClassName} aria-hidden="true">
|
||||
<AuthProviderIcon provider="apple" />
|
||||
</span>
|
||||
<span>Continue with Apple</span>
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -12,7 +12,6 @@ export * from "./auth-panel";
|
||||
export * from "./auth-primary-button";
|
||||
export * from "./auth-provider-icon";
|
||||
export * from "./auth-social-button";
|
||||
export * from "./auth-social-buttons";
|
||||
export * from "./auth-text-field";
|
||||
export * from "./auth-validators";
|
||||
export * from "./email-login-form";
|
||||
|
||||
Reference in New Issue
Block a user