mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-02-01 00:02:49 -05:00
Button fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { FC } from 'react'
|
import { FC } from 'react'
|
||||||
import Button, { ButtonVariant } from '../buttons/Button'
|
import Button, { ButtonVariant } from '../buttons/Button'
|
||||||
import { Icon, layers, download } from '@/components/icons'
|
import { Icon, trash, download } from '@/components/icons'
|
||||||
|
|
||||||
// Define available action types
|
// Define available action types
|
||||||
export type ActionType = 'install_cream' | 'uninstall_cream' | 'install_smoke' | 'uninstall_smoke'
|
export type ActionType = 'install_cream' | 'uninstall_cream' | 'install_smoke' | 'uninstall_smoke'
|
||||||
@@ -45,14 +45,12 @@ const ActionButton: FC<ActionButtonProps> = ({
|
|||||||
|
|
||||||
// Select appropriate icon based on action type and state
|
// Select appropriate icon based on action type and state
|
||||||
const getIconInfo = () => {
|
const getIconInfo = () => {
|
||||||
const isCream = action.includes('cream')
|
|
||||||
|
|
||||||
if (isInstalled) {
|
if (isInstalled) {
|
||||||
// Uninstall actions
|
// Uninstall actions
|
||||||
return { name: layers, variant: 'bold' }
|
return { name: trash, variant: 'solid' }
|
||||||
} else {
|
} else {
|
||||||
// Install actions
|
// Install actions
|
||||||
return { name: download, variant: isCream ? 'bold' : 'outline' }
|
return { name: download, variant: 'solid' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const AnimatedCheckbox = ({
|
|||||||
<input type="checkbox" checked={checked} onChange={onChange} className="checkbox-original" />
|
<input type="checkbox" checked={checked} onChange={onChange} className="checkbox-original" />
|
||||||
|
|
||||||
<span className={`checkbox-custom ${checked ? 'checked' : ''}`}>
|
<span className={`checkbox-custom ${checked ? 'checked' : ''}`}>
|
||||||
{checked && <Icon name={check} variant="bold" size="sm" className="checkbox-icon" />}
|
{checked && <Icon name={check} variant="solid" size="sm" className="checkbox-icon" />}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{(label || sublabel) && (
|
{(label || sublabel) && (
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|||||||
leftIcon?: React.ReactNode
|
leftIcon?: React.ReactNode
|
||||||
rightIcon?: React.ReactNode
|
rightIcon?: React.ReactNode
|
||||||
fullWidth?: boolean
|
fullWidth?: boolean
|
||||||
|
iconOnly?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +24,7 @@ const Button: FC<ButtonProps> = ({
|
|||||||
leftIcon,
|
leftIcon,
|
||||||
rightIcon,
|
rightIcon,
|
||||||
fullWidth = false,
|
fullWidth = false,
|
||||||
|
iconOnly = false,
|
||||||
className = '',
|
className = '',
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
@@ -43,11 +45,14 @@ const Button: FC<ButtonProps> = ({
|
|||||||
warning: 'btn-warning',
|
warning: 'btn-warning',
|
||||||
}[variant]
|
}[variant]
|
||||||
|
|
||||||
|
// Determine if this is an icon-only button
|
||||||
|
const isIconOnly = iconOnly || (!children && (leftIcon || rightIcon))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={`btn ${variantClass} ${sizeClass} ${fullWidth ? 'btn-full' : ''} ${
|
className={`btn ${variantClass} ${sizeClass} ${fullWidth ? 'btn-full' : ''} ${
|
||||||
isLoading ? 'btn-loading' : ''
|
isLoading ? 'btn-loading' : ''
|
||||||
} ${className}`}
|
} ${isIconOnly ? 'btn-icon-only' : ''} ${className}`}
|
||||||
disabled={disabled || isLoading}
|
disabled={disabled || isLoading}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
@@ -58,7 +63,7 @@ const Button: FC<ButtonProps> = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{leftIcon && !isLoading && <span className="btn-icon btn-icon-left">{leftIcon}</span>}
|
{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>}
|
{rightIcon && !isLoading && <span className="btn-icon btn-icon-right">{rightIcon}</span>}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user