UNPKG

@adonis-agora/authkit-react

Version:

Frontend ergonomics over AuthKit for AdonisJS + Inertia + React apps: a typed useAuth() hook, role-gating hooks and gating components.

14 lines (13 loc) 563 B
import { createElement } from 'react'; import { oauthRedirectUrl } from '../interaction/urls.js'; import { buttonClass } from '../utils.js'; function capitalize(value) { return value ? value[0].toUpperCase() + value.slice(1) : value; } export function OAuthButton({ provider, uid, basePath, children, className, ...rest }) { return createElement('a', { href: oauthRedirectUrl(provider, uid, basePath), className: buttonClass('authkit-button--ghost', className), ...rest, }, children ?? `Entrar com ${capitalize(provider)}`); }