- Changed component styles and classes to align with TailAdmin design patterns. - Updated color schemes, typography, and layout for consistency across components. - Refactored Info Row, Network Address Card, Notice Banner, Progress Bar, Resource Gauge, Section Header, Server Status, Spinner, Stat Card, and Tab Panel components. - Enhanced responsiveness and accessibility features in various components.
73 lines
3.0 KiB
PHP
73 lines
3.0 KiB
PHP
{{--
|
|
Action Toolbar Button Component - TailAdmin style
|
|
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' => 'border border-gray-300 bg-white text-gray-700 shadow-theme-xs hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700',
|
|
'primary' => 'border border-brand-200 bg-brand-50 text-brand-600 hover:bg-brand-100 dark:border-brand-800 dark:bg-brand-500/10 dark:text-brand-400 dark:hover:bg-brand-500/20',
|
|
'success' => 'border border-success-200 bg-success-50 text-success-600 hover:bg-success-100 dark:border-success-800 dark:bg-success-500/10 dark:text-success-400 dark:hover:bg-success-500/20',
|
|
'warning' => 'border border-warning-200 bg-warning-50 text-warning-600 hover:bg-warning-100 dark:border-warning-800 dark:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/20',
|
|
'danger' => 'border border-error-200 bg-error-50 text-error-600 hover:bg-error-100 dark:border-error-800 dark:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/20',
|
|
];
|
|
|
|
$sizes = [
|
|
'sm' => 'h-9 px-3 text-theme-xs',
|
|
'md' => 'h-10 px-4 text-theme-sm',
|
|
'lg' => 'h-11 px-5 text-theme-sm',
|
|
];
|
|
|
|
$iconSizes = [
|
|
'sm' => 'size-3.5',
|
|
'md' => 'size-4',
|
|
'lg' => 'size-4.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 justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-colors duration-150 focus:outline-none focus-visible:ring-3 focus-visible:ring-brand-500/20',
|
|
$variants[$variant] ?? $variants['default'],
|
|
$sizes[$size] ?? $sizes['md'],
|
|
'pointer-events-none opacity-50' => $disabled,
|
|
'cursor-wait' => $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>
|