mirror of
https://github.com/SrIzan10/stack.git
synced 2026-06-06 01:06:54 +00:00
fix: submitButton sending buttonText to the dom element
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
'use client'
|
||||
|
||||
import { Button, ButtonProps, buttonVariants } from "@/components/ui/button"
|
||||
import { Button, buttonVariants } from "@/components/ui/button"
|
||||
import { VariantProps } from "class-variance-authority"
|
||||
import { useFormStatus } from "react-dom"
|
||||
|
||||
export default function SubmitButton(props: Props) {
|
||||
const { pending } = useFormStatus()
|
||||
const { buttonText, ...propsRest } = props
|
||||
return (
|
||||
<Button type="submit" loading={pending} {...props}>
|
||||
<Button type="submit" loading={pending} {...propsRest}>
|
||||
{props.buttonText}
|
||||
</Button>
|
||||
)
|
||||
@@ -15,4 +16,4 @@ export default function SubmitButton(props: Props) {
|
||||
|
||||
export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
||||
buttonText: string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user