mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
optimize elements by reducing the bundle size required
This commit is contained in:
33
app/src/ui/elements/auth/SocialLink.tsx
Normal file
33
app/src/ui/elements/auth/SocialLink.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ucFirstAllSnakeToPascalWithSpaces } from "core/utils";
|
||||
import type { ReactNode } from "react";
|
||||
import { Button } from "ui/components/buttons/Button";
|
||||
import type { IconType } from "ui/components/buttons/IconButton";
|
||||
|
||||
export type SocialLinkProps = {
|
||||
label?: string;
|
||||
provider: string;
|
||||
icon?: IconType;
|
||||
action: "login" | "register";
|
||||
method?: "GET" | "POST";
|
||||
basepath?: string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
export function SocialLink({
|
||||
label,
|
||||
provider,
|
||||
icon,
|
||||
action,
|
||||
method = "POST",
|
||||
basepath = "/api/auth",
|
||||
children
|
||||
}: SocialLinkProps) {
|
||||
return (
|
||||
<form method={method} action={[basepath, name, action].join("/")} className="w-full">
|
||||
<Button type="submit" size="large" variant="outline" className="justify-center w-full">
|
||||
Continue with {label ?? ucFirstAllSnakeToPascalWithSpaces(provider)}
|
||||
</Button>
|
||||
{children}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user