style: disabled state for buttons (#724)

This commit is contained in:
Aaryan Khandelwal 2023-04-06 01:03:42 +05:30 committed by GitHub
parent c9d8a8dbd1
commit 65037b5031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -13,7 +13,7 @@ export const DangerButton: React.FC<ButtonProps> = ({
}) => ( }) => (
<button <button
type={type} type={type}
className={`${className} border font-medium duration-300 ${ className={`${className} border border-red-500 font-medium duration-300 ${
size === "sm" size === "sm"
? "rounded px-3 py-2 text-xs" ? "rounded px-3 py-2 text-xs"
: size === "md" : size === "md"
@ -21,13 +21,13 @@ export const DangerButton: React.FC<ButtonProps> = ({
: "rounded-lg px-4 py-2 text-base" : "rounded-lg px-4 py-2 text-base"
} ${ } ${
disabled disabled
? "cursor-not-allowed border-gray-300 bg-gray-300 text-black hover:border-gray-300 hover:border-opacity-100 hover:bg-gray-300 hover:bg-opacity-100 hover:text-black" ? "cursor-not-allowed bg-opacity-70 border-opacity-70 hover:bg-opacity-70 hover:border-opacity-70"
: "border-red-500" : ""
} ${ } ${
outline outline
? "bg-transparent hover:bg-red-500 hover:text-white" ? "bg-transparent text-red-500 hover:bg-red-500 hover:text-white"
: "bg-red-500 hover:border-opacity-90 hover:bg-opacity-90" : "text-white bg-red-500 hover:border-opacity-90 hover:bg-opacity-90"
} ${!disabled && !outline ? "text-white" : ""} ${loading ? "cursor-wait" : ""}`} } ${loading ? "cursor-wait" : ""}`}
onClick={onClick} onClick={onClick}
disabled={disabled || loading} disabled={disabled || loading}
> >

View File

@ -13,7 +13,7 @@ export const PrimaryButton: React.FC<ButtonProps> = ({
}) => ( }) => (
<button <button
type={type} type={type}
className={`${className} border font-medium duration-300 ${ className={`${className} border border-theme font-medium duration-300 ${
size === "sm" size === "sm"
? "rounded px-3 py-2 text-xs" ? "rounded px-3 py-2 text-xs"
: size === "md" : size === "md"
@ -21,13 +21,13 @@ export const PrimaryButton: React.FC<ButtonProps> = ({
: "rounded-lg px-4 py-2 text-base" : "rounded-lg px-4 py-2 text-base"
} ${ } ${
disabled disabled
? "cursor-not-allowed border-gray-300 bg-gray-300 text-black hover:border-gray-300 hover:border-opacity-100 hover:bg-gray-300 hover:bg-opacity-100 hover:text-black" ? "cursor-not-allowed bg-opacity-70 border-opacity-70 hover:bg-opacity-70 hover:border-opacity-70"
: "border-theme" : ""
} ${ } ${
outline outline
? "bg-transparent hover:bg-theme hover:text-white" ? "bg-transparent text-theme hover:bg-theme hover:text-white"
: "bg-theme hover:border-opacity-90 hover:bg-opacity-90" : "text-white bg-theme hover:border-opacity-90 hover:bg-opacity-90"
} ${!disabled && !outline ? "text-white" : ""} ${loading ? "cursor-wait" : ""}`} } ${loading ? "cursor-wait" : ""}`}
onClick={onClick} onClick={onClick}
disabled={disabled || loading} disabled={disabled || loading}
> >