Skip to content

Commit 518f497

Browse files
committed
feat: add disabled state to Button component and update usage in SignIn/SignUp modals
1 parent b0514bc commit 518f497

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

apps/client/src/components/Button.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ import { forwardRef, HTMLAttributes, PropsWithChildren } from 'react';
22

33
type ButtonProps = PropsWithChildren<HTMLAttributes<HTMLButtonElement>>;
44

5-
const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
6-
const { children, className, onClick } = props;
5+
const Button = forwardRef<
6+
HTMLButtonElement,
7+
ButtonProps & { disabled?: boolean }
8+
>((props, ref) => {
9+
const { children, className, disabled, onClick } = props;
710

811
return (
912
<button
13+
disabled={disabled}
1014
ref={ref}
1115
className={`flex items-center justify-center rounded-md px-3 py-2 ${className}`}
1216
type='button'

apps/client/src/components/modal/SignInModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ function SignInModal() {
6262
</div>
6363
</Button>
6464
<Button
65+
disabled={!isLoginEnabled}
6566
className={`transition-colors duration-200 ${isLoginEnabled ? 'bg-indigo-600' : 'cursor-not-allowed bg-indigo-300'}`}
6667
onClick={login}
6768
>

apps/client/src/components/modal/SignUpModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function SignUpModal() {
9292
</div>
9393
</Button>
9494
<Button
95+
disabled={!isSignUpButtonEnabled}
9596
className={`transition-colors duration-200 ${isSignUpButtonEnabled ? 'bg-indigo-600' : 'cursor-not-allowed bg-indigo-300'}`}
9697
onClick={handleSignUp}
9798
>

0 commit comments

Comments
 (0)