Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/action-button.blade.php
Joseph.Rawlings 7190d7a818 refactor: update UI components to shadcn-style
- Refactored select component to align with shadcn design principles.
- Updated server status indicator component for consistency with shadcn style.
- Modified spinner component to follow shadcn design guidelines.
- Enhanced stat card component with shadcn-inspired styles.
- Adjusted tab panel component to reflect shadcn design updates.
- Revamped table row and table data cell components to match shadcn aesthetics.
- Updated table header cell component for improved styling consistency.
- Refined table component to align with shadcn design principles.
- Enhanced tabs component with shadcn-inspired styles.
- Updated toggle component to follow shadcn design guidelines.
- Refactored tooltip component to align with shadcn design principles.
- Updated server card component to reflect shadcn-inspired design.
2025-12-17 11:47:42 -05:00

73 lines
2.5 KiB
PHP

{{--
Action Toolbar Button Component - shadcn-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 bg-background hover:bg-accent hover:text-accent-foreground',
'primary' => 'border border-primary/20 bg-primary/10 text-primary hover:bg-primary/20',
'success' => 'border border-success/20 bg-success/10 text-success hover:bg-success/20',
'warning' => 'border border-warning/20 bg-warning/10 text-warning hover:bg-warning/20',
'danger' => 'border border-danger/20 bg-danger/10 text-danger hover:bg-danger/20',
];
$sizes = [
'sm' => 'h-8 px-3 text-xs',
'md' => 'h-9 px-4 text-sm',
'lg' => 'h-10 px-5 text-sm',
];
$iconSizes = [
'sm' => 'size-3.5',
'md' => 'size-4',
'lg' => 'size-4',
];
@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-md font-medium ring-offset-background transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
$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>