Skip to content

Commit c511814

Browse files
committed
replace disabled to pending
1 parent e85030a commit c511814

File tree

8 files changed

+29
-14
lines changed

8 files changed

+29
-14
lines changed

resources/js/pages/auth/confirm-password.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEffect } from "react"
44
import { Button } from "@/components/ui/button"
55
import { Form } from "@/components/ui/form"
66
import { TextField } from "@/components/ui/text-field"
7+
import { Loader } from "@/components/ui/loader"
78

89
export default function ConfirmPassword() {
910
const { data, setData, post, processing, errors, reset } = useForm({
@@ -16,7 +17,7 @@ export default function ConfirmPassword() {
1617
}
1718
}, [])
1819

19-
const submit = (e: { preventDefault: () => void }) => {
20+
const submit = (e: React.FormEvent) => {
2021
e.preventDefault()
2122

2223
post("/confirm-password")
@@ -43,7 +44,10 @@ export default function ConfirmPassword() {
4344
/>
4445

4546
<div className="mt-4 flex items-center justify-end">
46-
<Button isDisabled={processing}>Confirm</Button>
47+
<Button isPending={processing}>
48+
{processing && <Loader />}
49+
Confirm
50+
</Button>
4751
</div>
4852
</Form>
4953
</>

resources/js/pages/auth/forgot-password.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Head, useForm } from "@inertiajs/react"
33
import { Button } from "@/components/ui/button"
44
import { Form } from "@/components/ui/form"
55
import { TextField } from "@/components/ui/text-field"
6+
import { Loader } from "@/components/ui/loader"
67

78
interface ForgotPasswordProps {
89
status: string
@@ -13,7 +14,7 @@ export default function ForgotPassword({ status }: ForgotPasswordProps) {
1314
email: "",
1415
})
1516

16-
const submit = (e: { preventDefault: () => void }) => {
17+
const submit = (e: React.FormEvent) => {
1718
e.preventDefault()
1819
post(route("password.email"))
1920
}
@@ -35,7 +36,8 @@ export default function ForgotPassword({ status }: ForgotPasswordProps) {
3536
/>
3637

3738
<div className="flex items-center justify-end">
38-
<Button type="submit" className="w-full" isDisabled={processing}>
39+
<Button type="submit" className="w-full" isPending={processing}>
40+
{processing && <Loader />}
3941
Email Password Reset Link
4042
</Button>
4143
</div>

resources/js/pages/auth/login.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Checkbox } from "@/components/ui/checkbox"
77
import { Form } from "@/components/ui/form"
88
import { Link } from "@/components/ui/link"
99
import { TextField } from "@/components/ui/text-field"
10+
import { Loader } from "@/components/ui/loader"
1011

1112
interface LoginProps {
1213
status: string
@@ -27,7 +28,7 @@ export default function Login(args: LoginProps) {
2728
}
2829
}, [])
2930

30-
const submit = (e: { preventDefault: () => void }) => {
31+
const submit = (e: React.FormEvent) => {
3132
e.preventDefault()
3233

3334
post("/login")
@@ -76,7 +77,8 @@ export default function Login(args: LoginProps) {
7677
</Link>
7778
)}
7879
</div>
79-
<Button isDisabled={processing} type="submit">
80+
<Button isPending={processing} type="submit">
81+
{processing && <Loader />}
8082
Log in
8183
</Button>
8284
<div className="text-center">

resources/js/pages/auth/register.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button"
66
import { Link } from "@/components/ui/link"
77
import { TextField } from "@/components/ui/text-field"
88
import { Form } from "@/components/ui/form"
9+
import { Loader } from "@/components/ui/loader"
910

1011
export default function Register() {
1112
const { data, setData, post, processing, errors, reset } = useForm({
@@ -22,7 +23,7 @@ export default function Register() {
2223
}
2324
}, [])
2425

25-
const submit = (e: React.FormEvent<HTMLFormElement>) => {
26+
const submit = (e: React.FormEvent) => {
2627
e.preventDefault()
2728

2829
post("/register")
@@ -73,7 +74,8 @@ export default function Register() {
7374
errorMessage={errors.password_confirmation}
7475
isRequired
7576
/>
76-
<Button type="submit" className="w-full" isDisabled={processing}>
77+
<Button type="submit" className="w-full" isPending={processing}>
78+
{processing && <Loader />}
7779
Register
7880
</Button>
7981
<div className="text-center">

resources/js/pages/auth/reset-password.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEffect } from "react"
44
import { Button } from "@/components/ui/button"
55
import { TextField } from "@/components/ui/text-field"
66
import { Form } from "@/components/ui/form"
7+
import { Loader } from "@/components/ui/loader"
78

89
interface ResetPasswordProps {
910
token: string
@@ -25,7 +26,7 @@ export default function ResetPassword(args: ResetPasswordProps) {
2526
}
2627
}, [])
2728

28-
const submit = (e: React.FormEvent<HTMLFormElement>) => {
29+
const submit = (e: React.FormEvent) => {
2930
e.preventDefault()
3031
post(route("password.request"))
3132
}
@@ -70,7 +71,8 @@ export default function ResetPassword(args: ResetPasswordProps) {
7071
/>
7172

7273
<div className="mt-4 flex items-center justify-end">
73-
<Button type="submit" className="ml-4" isDisabled={processing}>
74+
<Button type="submit" className="ml-4" isPending={processing}>
75+
{processing && <Loader />}
7476
Reset Password
7577
</Button>
7678
</div>

resources/js/pages/auth/verify-email.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { Head, useForm } from "@inertiajs/react"
33
import { Button } from "@/components/ui/button"
44
import { Form } from "@/components/ui/form"
55
import { Link } from "@/components/ui/link"
6+
import { Loader } from "@/components/ui/loader"
7+
import type React from "react"
68

79
export default function VerifyEmail({ status }: { status?: any }) {
810
const { post, processing } = useForm()
911

10-
const submit = (e: React.FormEvent<HTMLFormElement>) => {
12+
const submit = (e: React.FormEvent) => {
1113
e.preventDefault()
1214

1315
post(route("verification.send"))
@@ -24,7 +26,8 @@ export default function VerifyEmail({ status }: { status?: any }) {
2426

2527
<div className="mt-4 flex items-center justify-between">
2628
<Form onSubmit={submit}>
27-
<Button isDisabled={processing} type="submit">
29+
<Button isPending={processing} type="submit">
30+
{processing && <Loader />}
2831
Resend Verification Email
2932
</Button>
3033
</Form>

resources/js/pages/settings/password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function Password() {
1818
password_confirmation: "",
1919
})
2020

21-
const submit = (e: React.FormEvent<HTMLFormElement>) => {
21+
const submit = (e: React.FormEvent) => {
2222
e.preventDefault()
2323
put(route("password.update"), {
2424
preserveScroll: true,

resources/js/pages/settings/profile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function Profile({ mustVerifyEmail, status }: Props) {
2222
email: auth.user.email ?? "",
2323
})
2424

25-
const submit = (e: React.FormEvent<HTMLFormElement>) => {
25+
const submit = (e: React.FormEvent) => {
2626
e.preventDefault()
2727
patch("/settings/profile", {
2828
preserveScroll: true,

0 commit comments

Comments
 (0)