Refactor components to align with AdminLTE styles

- Updated alert component to use AdminLTE variant classes and added callout support.
- Refined badge component with AdminLTE base and variant classes, including size adjustments.
- Modified button component to implement AdminLTE button styles and improved loading indicators.
- Enhanced card component with AdminLTE variant classes and improved header/footer structure.
- Adjusted input component to follow AdminLTE design, including size classes and icon handling.
- Updated layout component to streamline button styles and loading indicators.
- Refined progress component to utilize AdminLTE styles for size and variant classes.
- Enhanced table component with AdminLTE table classes and improved loading state representation.
This commit is contained in:
2025-12-17 17:55:03 -05:00
parent e6e0f34d3a
commit b7b81b0d3a
8 changed files with 259 additions and 298 deletions

View File

@@ -14,17 +14,17 @@
])
@php
// Base classes
$baseClasses = 'inline-flex items-center justify-center font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed';
// AdminLTE button base class
$baseClasses = 'lte-btn';
// Size classes
// Size classes - AdminLTE style
$sizeClasses = match($size) {
'xs' => 'px-2 py-1 text-xs gap-1',
'sm' => 'px-3 py-1.5 text-sm gap-1.5',
'md' => 'px-4 py-2 text-sm gap-2',
'lg' => 'px-5 py-2.5 text-base gap-2',
'xl' => 'px-6 py-3 text-base gap-2.5',
default => 'px-4 py-2 text-sm gap-2',
'xs' => 'lte-btn-sm',
'sm' => 'lte-btn-sm',
'md' => '',
'lg' => 'lte-btn-lg',
'xl' => 'lte-btn-lg',
default => '',
};
// Icon size classes
@@ -37,72 +37,43 @@
default => 'size-4',
};
// Variant classes
// Variant classes - AdminLTE style
$variantClasses = match($variant) {
'primary' => $outline
? 'border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary/50'
: 'bg-primary text-white hover:bg-primary/90 focus:ring-primary/50',
'secondary' => $outline
? 'border-2 border-secondary text-secondary hover:bg-secondary hover:text-white focus:ring-secondary/50'
: 'bg-secondary text-white hover:bg-secondary/90 focus:ring-secondary/50',
'success' => $outline
? 'border-2 border-success text-success hover:bg-success hover:text-white focus:ring-success/50'
: 'bg-success text-white hover:bg-success/90 focus:ring-success/50',
'danger' => $outline
? 'border-2 border-danger text-danger hover:bg-danger hover:text-white focus:ring-danger/50'
: 'bg-danger text-white hover:bg-danger/90 focus:ring-danger/50',
'warning' => $outline
? 'border-2 border-warning text-warning hover:bg-warning hover:text-white focus:ring-warning/50'
: 'bg-warning text-white hover:bg-warning/90 focus:ring-warning/50',
'info' => $outline
? 'border-2 border-info text-info hover:bg-info hover:text-white focus:ring-info/50'
: 'bg-info text-white hover:bg-info/90 focus:ring-info/50',
'ghost' => 'text-base/70 hover:text-base/90 hover:bg-neutral/10 focus:ring-neutral/50',
'link' => 'text-primary hover:text-primary/80 underline-offset-4 hover:underline focus:ring-primary/50 p-0',
'neutral' => $outline
? 'border border-neutral/30 text-base/70 hover:bg-neutral/10 hover:text-base/90 focus:ring-neutral/50'
: 'bg-neutral/10 text-base/80 hover:bg-neutral/20 focus:ring-neutral/50',
default => $outline
? 'border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary/50'
: 'bg-primary text-white hover:bg-primary/90 focus:ring-primary/50',
};
// Rounded classes
$roundedClasses = match($rounded) {
'none' => 'rounded-none',
'sm' => 'rounded-sm',
'md' => 'rounded-md',
'lg' => 'rounded-lg',
'xl' => 'rounded-xl',
'full' => 'rounded-full',
default => 'rounded-lg',
'primary' => $outline ? 'lte-btn-outline-primary' : 'lte-btn-primary',
'secondary' => $outline ? 'lte-btn-outline-secondary' : 'lte-btn-secondary',
'success' => $outline ? 'lte-btn-outline-success' : 'lte-btn-success',
'danger' => $outline ? 'lte-btn-outline-danger' : 'lte-btn-danger',
'warning' => 'lte-btn-warning',
'info' => 'lte-btn-info',
'ghost' => 'lte-btn-outline-secondary',
'link' => 'lte-text-primary',
'neutral' => $outline ? 'lte-btn-outline-secondary' : 'lte-btn-secondary',
default => $outline ? 'lte-btn-outline-primary' : 'lte-btn-primary',
};
// Full width
$widthClasses = $fullWidth ? 'w-full' : '';
// Combined classes
$classes = "$baseClasses $sizeClasses $variantClasses $roundedClasses $widthClasses";
$classes = trim("$baseClasses $sizeClasses $variantClasses $widthClasses");
// Determine tag
$tag = $href ? 'a' : 'button';
@endphp
@if($href)
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }} style="border-radius: 0.375rem;">
@else
<button
type="{{ $type }}"
{{ $disabled || $loading ? 'disabled' : '' }}
{{ $attributes->merge(['class' => $classes]) }}
style="border-radius: 0.375rem;"
>
@endif
@if($loading)
<svg class="animate-spin {{ $iconSizeClasses }}" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span class="lte-spinner lte-spinner-sm" style="margin-right: 0.5rem;"></span>
@elseif($icon && $iconPosition === 'left')
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
@endif