mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
This PR runs `prettier` on the `examples` folder. Depends on https://github.com/supabase/supabase/pull/43849.
21 lines
487 B
TypeScript
21 lines
487 B
TypeScript
'use client'
|
|
|
|
import { useFormStatus } from 'react-dom'
|
|
import { type ComponentProps } from 'react'
|
|
|
|
type Props = ComponentProps<'button'> & {
|
|
pendingText?: string
|
|
}
|
|
|
|
export function SubmitButton({ children, pendingText, ...props }: Props) {
|
|
const { pending, action } = useFormStatus()
|
|
|
|
const isPending = pending && action === props.formAction
|
|
|
|
return (
|
|
<button {...props} type="submit" aria-disabled={pending}>
|
|
{isPending ? pendingText : children}
|
|
</button>
|
|
)
|
|
}
|