mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-31 07:42:52 -05:00
Button fixes
This commit is contained in:
@@ -10,6 +10,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
leftIcon?: React.ReactNode
|
||||
rightIcon?: React.ReactNode
|
||||
fullWidth?: boolean
|
||||
iconOnly?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ const Button: FC<ButtonProps> = ({
|
||||
leftIcon,
|
||||
rightIcon,
|
||||
fullWidth = false,
|
||||
iconOnly = false,
|
||||
className = '',
|
||||
disabled,
|
||||
...props
|
||||
@@ -43,11 +45,14 @@ const Button: FC<ButtonProps> = ({
|
||||
warning: 'btn-warning',
|
||||
}[variant]
|
||||
|
||||
// Determine if this is an icon-only button
|
||||
const isIconOnly = iconOnly || (!children && (leftIcon || rightIcon))
|
||||
|
||||
return (
|
||||
<button
|
||||
className={`btn ${variantClass} ${sizeClass} ${fullWidth ? 'btn-full' : ''} ${
|
||||
isLoading ? 'btn-loading' : ''
|
||||
} ${className}`}
|
||||
} ${isIconOnly ? 'btn-icon-only' : ''} ${className}`}
|
||||
disabled={disabled || isLoading}
|
||||
{...props}
|
||||
>
|
||||
@@ -58,10 +63,10 @@ const Button: FC<ButtonProps> = ({
|
||||
)}
|
||||
|
||||
{leftIcon && !isLoading && <span className="btn-icon btn-icon-left">{leftIcon}</span>}
|
||||
<span className="btn-text">{children}</span>
|
||||
{children && <span className="btn-text">{children}</span>}
|
||||
{rightIcon && !isLoading && <span className="btn-icon btn-icon-right">{rightIcon}</span>}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
export default Button
|
||||
export default Button
|
||||
Reference in New Issue
Block a user