Skip to content

Commit 2a7eb71

Browse files
committed
use shadcn spinner component
1 parent d116cca commit 2a7eb71

File tree

7 files changed

+30
-23
lines changed

7 files changed

+30
-23
lines changed

resources/js/components/two-factor-setup-modal.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import { OTP_MAX_LENGTH } from '@/hooks/use-two-factor-auth';
1717
import { confirm } from '@/routes/two-factor';
1818
import { Form } from '@inertiajs/react';
1919
import { REGEXP_ONLY_DIGITS } from 'input-otp';
20-
import { Check, Copy, Loader2, ScanLine } from 'lucide-react';
20+
import { Check, Copy, ScanLine } from 'lucide-react';
2121
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2222
import AlertError from './alert-error';
23+
import { Spinner } from './ui/spinner';
2324

2425
function GridScanIcon() {
2526
return (
@@ -79,7 +80,7 @@ function TwoFactorSetupStep({
7980
}}
8081
/>
8182
) : (
82-
<Loader2 className="flex size-4 animate-spin" />
83+
<Spinner />
8384
)}
8485
</div>
8586
</div>
@@ -102,7 +103,7 @@ function TwoFactorSetupStep({
102103
<div className="flex w-full items-stretch overflow-hidden rounded-xl border border-border">
103104
{!manualSetupKey ? (
104105
<div className="flex h-full w-full items-center justify-center bg-muted p-3">
105-
<Loader2 className="size-4 animate-spin" />
106+
<Spinner />
106107
</div>
107108
) : (
108109
<>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Loader2Icon } from "lucide-react"
2+
3+
import { cn } from "@/lib/utils"
4+
5+
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
6+
return (
7+
<Loader2Icon
8+
role="status"
9+
aria-label="Loading"
10+
className={cn("size-4 animate-spin", className)}
11+
{...props}
12+
/>
13+
)
14+
}
15+
16+
export { Spinner }

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import InputError from '@/components/input-error';
22
import { Button } from '@/components/ui/button';
33
import { Input } from '@/components/ui/input';
4-
import { Label } from '@/components/ui/label';
4+
import { Spinner } from '@/components/ui/spinner';
55
import AuthLayout from '@/layouts/auth-layout';
66
import { store } from '@/routes/password/confirm';
77
import { Form, Head } from '@inertiajs/react';
@@ -38,9 +38,7 @@ export default function ConfirmPassword() {
3838
disabled={processing}
3939
data-test="confirm-password-button"
4040
>
41-
{processing && (
42-
<LoaderCircle className="h-4 w-4 animate-spin" />
43-
)}
41+
{processing && <Spinner />}
4442
Confirm password
4543
</Button>
4644
</div>

resources/js/pages/auth/login.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { Button } from '@/components/ui/button';
55
import { Checkbox } from '@/components/ui/checkbox';
66
import { Input } from '@/components/ui/input';
77
import { Label } from '@/components/ui/label';
8+
import { Spinner } from '@/components/ui/spinner';
89
import AuthLayout from '@/layouts/auth-layout';
910
import { register } from '@/routes';
1011
import { request } from '@/routes/password';
1112
import { Form, Head } from '@inertiajs/react';
12-
import { LoaderCircle } from 'lucide-react';
1313

1414
interface LoginProps {
1515
status?: string;
@@ -88,9 +88,7 @@ export default function Login({ status, canResetPassword }: LoginProps) {
8888
disabled={processing}
8989
data-test="login-button"
9090
>
91-
{processing && (
92-
<LoaderCircle className="h-4 w-4 animate-spin" />
93-
)}
91+
{processing && <Spinner />}
9492
Log in
9593
</Button>
9694
</div>

resources/js/pages/auth/register.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import RegisteredUserController from '@/actions/App/Http/Controllers/Auth/RegisteredUserController';
22
import { login } from '@/routes';
33
import { Form, Head } from '@inertiajs/react';
4-
import { LoaderCircle } from 'lucide-react';
54

65
import InputError from '@/components/input-error';
76
import TextLink from '@/components/text-link';
87
import { Button } from '@/components/ui/button';
98
import { Input } from '@/components/ui/input';
109
import { Label } from '@/components/ui/label';
10+
import { Spinner } from '@/components/ui/spinner';
1111
import AuthLayout from '@/layouts/auth-layout';
1212

1313
export default function Register() {
@@ -96,9 +96,7 @@ export default function Register() {
9696
tabIndex={5}
9797
data-test="register-user-button"
9898
>
99-
{processing && (
100-
<LoaderCircle className="h-4 w-4 animate-spin" />
101-
)}
99+
{processing && <Spinner />}
102100
Create account
103101
</Button>
104102
</div>

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import NewPasswordController from '@/actions/App/Http/Controllers/Auth/NewPasswordController';
22
import { Form, Head } from '@inertiajs/react';
3-
import { LoaderCircle } from 'lucide-react';
43

54
import InputError from '@/components/input-error';
65
import { Button } from '@/components/ui/button';
76
import { Input } from '@/components/ui/input';
87
import { Label } from '@/components/ui/label';
8+
import { Spinner } from '@/components/ui/spinner';
99
import AuthLayout from '@/layouts/auth-layout';
1010

1111
interface ResetPasswordProps {
@@ -83,9 +83,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) {
8383
disabled={processing}
8484
data-test="reset-password-button"
8585
>
86-
{processing && (
87-
<LoaderCircle className="h-4 w-4 animate-spin" />
88-
)}
86+
{processing && <Spinner />}
8987
Reset password
9088
</Button>
9189
</div>

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import EmailVerificationNotificationController from '@/actions/App/Http/Controllers/Auth/EmailVerificationNotificationController';
33
import { logout } from '@/routes';
44
import { Form, Head } from '@inertiajs/react';
5-
import { LoaderCircle } from 'lucide-react';
65

76
import TextLink from '@/components/text-link';
87
import { Button } from '@/components/ui/button';
8+
import { Spinner } from '@/components/ui/spinner';
99
import AuthLayout from '@/layouts/auth-layout';
1010

1111
export default function VerifyEmail({ status }: { status?: string }) {
@@ -30,9 +30,7 @@ export default function VerifyEmail({ status }: { status?: string }) {
3030
{({ processing }) => (
3131
<>
3232
<Button disabled={processing} variant="secondary">
33-
{processing && (
34-
<LoaderCircle className="h-4 w-4 animate-spin" />
35-
)}
33+
{processing && <Spinner />}
3634
Resend verification email
3735
</Button>
3836

0 commit comments

Comments
 (0)