Files
simstudioai--sim/apps/sim/app/(auth)/components/auth-text-link.tsx
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

59 lines
1.5 KiB
TypeScript

'use client'
import type { ReactNode } from 'react'
import { cn } from '@sim/emcn'
import Link from 'next/link'
const AUTH_TEXT_LINK_CLASS =
'text-[var(--text-secondary)] underline-offset-4 transition-colors hover:text-[var(--text-primary)] hover:underline disabled:cursor-not-allowed disabled:opacity-50'
interface AuthTextLinkProps {
children: ReactNode
/** Renders a navigation link when set; otherwise renders an action button. */
href?: string
onClick?: () => void
/** Opens the link in a new tab with safe `rel` (e.g. Terms/Privacy). */
external?: boolean
disabled?: boolean
className?: string
}
/**
* The canonical inline text affordance for the auth pages — forgot-password,
* resend, and the legal links. Renders a {@link Link} when `href` is set and a
* `<button>` otherwise, both in one light-token style. Replaces the legacy dark
* `AUTH_TEXT_LINK` class string with a single props-driven source of truth.
*/
export function AuthTextLink({
children,
href,
onClick,
external = false,
disabled = false,
className,
}: AuthTextLinkProps) {
if (href) {
return (
<Link
href={href}
onClick={onClick}
className={cn(AUTH_TEXT_LINK_CLASS, className)}
{...(external ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
>
{children}
</Link>
)
}
return (
<button
type='button'
onClick={onClick}
disabled={disabled}
className={cn(AUTH_TEXT_LINK_CLASS, className)}
>
{children}
</button>
)
}