Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/action-button.blade.php
Joseph.Rawlings e7b33a2f6c Refactor Proxmox server views for improved UI consistency and usability
- Updated server card component to use new UI elements and improved layout.
- Enhanced status display with badges and better status indicators.
- Refined quick info row for server details with consistent styling.
- Reorganized server configuration statistics into stat cards for clarity.
- Improved help modals for statistics and storage management sections.
- Streamlined alerts and warnings for better user experience.
- Updated storage management view to utilize new UI components and improve readability.
2025-12-17 11:24:17 -05:00

73 lines
3.1 KiB
PHP

{{--
Action Toolbar Button Component - TailServer Theme
Individual button for VM control actions
Usage:
<x-proxmox::ui.action-button
action="start"
wire:click="startServer"
icon="ri-play-fill"
label="Start"
/>
--}}
@props([
'action' => null,
'icon' => null,
'label',
'variant' => 'default', // default, danger, warning, success
'disabled' => false,
'loading' => false,
'confirm' => null,
'size' => 'md', // sm, md, lg
])
@php
$variants = [
'default' => 'bg-gradient-to-b from-neutral/5 to-neutral/10 hover:from-neutral/10 hover:to-neutral/15 text-base border border-neutral/20 hover:border-neutral/30 shadow-sm hover:shadow',
'primary' => 'bg-gradient-to-b from-primary/10 to-primary/15 hover:from-primary/15 hover:to-primary/20 text-primary border border-primary/20 hover:border-primary/30 shadow-sm hover:shadow-md hover:shadow-primary/10',
'success' => 'bg-gradient-to-b from-success/10 to-success/15 hover:from-success/15 hover:to-success/20 text-success border border-success/20 hover:border-success/30 shadow-sm hover:shadow-md hover:shadow-success/10',
'warning' => 'bg-gradient-to-b from-warning/10 to-warning/15 hover:from-warning/15 hover:to-warning/20 text-warning border border-warning/20 hover:border-warning/30 shadow-sm hover:shadow-md hover:shadow-warning/10',
'danger' => 'bg-gradient-to-b from-danger/10 to-danger/15 hover:from-danger/15 hover:to-danger/20 text-danger border border-danger/20 hover:border-danger/30 shadow-sm hover:shadow-md hover:shadow-danger/10',
];
$sizes = [
'sm' => 'px-2.5 py-1.5 text-xs',
'md' => 'px-3.5 py-2 text-sm',
'lg' => 'px-5 py-2.5 text-base',
];
$iconSizes = [
'sm' => 'size-3.5',
'md' => 'size-4',
'lg' => 'size-5',
];
@endphp
<button
type="button"
@if($confirm)
x-data=""
@click="if(confirm('{{ $confirm }}')) { $wire.call('{{ $action }}') }"
@endif
{{ $attributes->merge([
'disabled' => $disabled || $loading,
])->class([
'inline-flex items-center gap-2 rounded-xl font-medium transition-all duration-200 hover:-translate-y-0.5 active:translate-y-0 active:scale-95',
$variants[$variant] ?? $variants['default'],
$sizes[$size] ?? $sizes['md'],
'opacity-50 cursor-not-allowed hover:translate-y-0' => $disabled,
'cursor-wait hover:translate-y-0' => $loading,
]) }}
>
@if($loading)
<svg class="animate-spin {{ $iconSizes[$size] ?? 'size-4' }}" 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>
@elseif($icon)
<x-dynamic-component :component="$icon" class="{{ $iconSizes[$size] ?? 'size-4' }}" />
@endif
<span>{{ $label }}</span>
</button>