98 lines
3.2 KiB
PHP
98 lines
3.2 KiB
PHP
{{--
|
|
Card Component - shadcn-inspired
|
|
|
|
Usage:
|
|
<x-proxmox::ui.card>Content</x-proxmox::ui.card>
|
|
<x-proxmox::ui.card title="Title" subtitle="Subtitle" icon="ri-server-line">Content</x-proxmox::ui.card>
|
|
<x-proxmox::ui.card :collapsible="true" :collapsed="false">Content</x-proxmox::ui.card>
|
|
--}}
|
|
|
|
@props([
|
|
'title' => null,
|
|
'subtitle' => null,
|
|
'icon' => null,
|
|
'iconColor' => 'text-primary',
|
|
'actions' => null,
|
|
'footer' => null,
|
|
'footerClass' => '',
|
|
'padding' => true,
|
|
'hover' => false,
|
|
'clickable' => false,
|
|
'collapsible' => false,
|
|
'collapsed' => false,
|
|
])
|
|
|
|
<div
|
|
{{ $attributes->class([
|
|
'rounded-xl border bg-card shadow-sm',
|
|
'hover:bg-accent/50 transition-colors duration-150' => $hover || $clickable,
|
|
'cursor-pointer' => $clickable,
|
|
]) }}
|
|
@if($collapsible)
|
|
x-data="{ isCollapsed: {{ $collapsed ? 'true' : 'false' }} }"
|
|
@endif
|
|
>
|
|
@if($title || $actions)
|
|
<div class="flex items-center justify-between gap-4 p-6 pb-0">
|
|
<div class="flex items-center gap-3">
|
|
@if($icon)
|
|
<div class="flex items-center justify-center size-9 rounded-lg bg-primary/10">
|
|
<x-dynamic-component :component="$icon" class="size-4 {{ $iconColor }}" />
|
|
</div>
|
|
@endif
|
|
<div class="space-y-1">
|
|
@if($title)
|
|
<h3 class="font-semibold leading-none tracking-tight">{{ $title }}</h3>
|
|
@endif
|
|
@if($subtitle)
|
|
<p class="text-sm text-muted-foreground">{{ $subtitle }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@if($actions || $collapsible)
|
|
<div class="flex items-center gap-2">
|
|
@if($actions)
|
|
{{ $actions }}
|
|
@endif
|
|
@if($collapsible)
|
|
<button
|
|
type="button"
|
|
@click="isCollapsed = !isCollapsed"
|
|
class="p-1.5 rounded-md hover:bg-muted transition-colors duration-150"
|
|
>
|
|
<x-ri-arrow-down-s-line
|
|
class="size-4 text-muted-foreground transition-transform duration-150"
|
|
x-bind:class="isCollapsed ? 'rotate-180' : ''"
|
|
/>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
<div
|
|
@class([
|
|
'p-6',
|
|
'pt-4' => $title,
|
|
])
|
|
@if($collapsible)
|
|
x-show="!isCollapsed"
|
|
x-transition:enter="transition ease-out duration-150"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition ease-in duration-100"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
@endif
|
|
>
|
|
{{ $slot }}
|
|
</div>
|
|
|
|
@if($footer)
|
|
<div class="flex items-center p-6 pt-0 {{ $footerClass }}">
|
|
{{ $footer }}
|
|
</div>
|
|
@endif
|
|
</div>
|