refactor: update components to shadcn-inspired styling and improve layout consistency

This commit is contained in:
2025-12-17 11:53:57 -05:00
parent eb015f3421
commit 71ea61a960
7 changed files with 165 additions and 169 deletions

View File

@@ -1,5 +1,5 @@
{{--
Icon Picker Component - TailServer Theme
Icon Picker Component - shadcn-inspired
Modal-based icon picker with search and categories
Usage:
@@ -40,15 +40,15 @@
<button
type="button"
@click="open = true"
class="flex items-center gap-2 px-3 py-2 bg-neutral/5 hover:bg-neutral/10 rounded-lg border border-neutral/20 transition-colors"
class="flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-muted transition-colors duration-150"
>
<template x-if="selected">
<x-dynamic-component x-bind:component="selected" class="size-5 text-primary" />
</template>
<template x-if="!selected">
<x-ri-image-add-line class="size-5 text-base/40" />
<x-ri-image-add-line class="size-5 text-muted-foreground" />
</template>
<span class="text-sm text-base">Select Icon</span>
<span class="text-sm">Select Icon</span>
</button>
<!-- Modal -->
@@ -62,10 +62,10 @@
<!-- Backdrop -->
<div
x-show="open"
x-transition:enter="ease-out duration-200"
x-transition:enter="ease-out duration-150"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-150"
x-transition:leave="ease-in duration-100"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="open = false"
@@ -75,50 +75,50 @@
<!-- Modal Content -->
<div
x-show="open"
x-transition:enter="ease-out duration-200"
x-transition:enter="ease-out duration-150"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-150"
x-transition:leave="ease-in duration-100"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="relative bg-background rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] overflow-hidden"
class="relative rounded-xl border bg-card shadow-lg w-full max-w-2xl max-h-[80vh] overflow-hidden"
>
<!-- Header -->
<div class="p-4 border-b border-neutral/10">
<div class="p-4 border-b">
<div class="flex items-center justify-between mb-3">
<h3 class="text-lg font-semibold text-base">Select Icon</h3>
<button @click="open = false" class="p-1 rounded hover:bg-neutral/10 text-base/40 hover:text-base">
<h3 class="text-lg font-semibold">Select Icon</h3>
<button @click="open = false" class="p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors duration-150">
<x-ri-close-line class="size-5" />
</button>
</div>
<!-- Search -->
<div class="relative">
<x-ri-search-line class="absolute left-3 top-1/2 -translate-y-1/2 size-4 text-base/40" />
<x-ri-search-line class="absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" />
<input
type="text"
x-model="search"
placeholder="Search icons..."
class="w-full pl-10 pr-4 py-2 bg-neutral/5 border border-neutral/20 rounded-lg text-sm text-base placeholder:text-base/40 focus:outline-none focus:ring-2 focus:ring-primary/50"
class="w-full pl-10 pr-4 py-2 rounded-lg border bg-background text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
/>
</div>
</div>
<!-- Categories -->
@if(count($categories) > 0)
<div class="flex gap-2 p-4 border-b border-neutral/10 overflow-x-auto">
<div class="flex gap-2 p-4 border-b overflow-x-auto">
<button
@click="activeCategory = 'all'"
:class="activeCategory === 'all' ? 'bg-primary text-white' : 'bg-neutral/5 text-base hover:bg-neutral/10'"
class="px-3 py-1 rounded-full text-xs font-medium transition-colors whitespace-nowrap"
:class="activeCategory === 'all' ? 'bg-primary text-primary-foreground' : 'bg-muted hover:bg-muted/80'"
class="px-3 py-1 rounded-full text-xs font-medium transition-colors duration-150 whitespace-nowrap"
>
All
</button>
@foreach($categories as $category)
<button
@click="activeCategory = '{{ $category['id'] }}'"
:class="activeCategory === '{{ $category['id'] }}' ? 'bg-primary text-white' : 'bg-neutral/5 text-base hover:bg-neutral/10'"
class="px-3 py-1 rounded-full text-xs font-medium transition-colors whitespace-nowrap"
:class="activeCategory === '{{ $category['id'] }}' ? 'bg-primary text-primary-foreground' : 'bg-muted hover:bg-muted/80'"
class="px-3 py-1 rounded-full text-xs font-medium transition-colors duration-150 whitespace-nowrap"
>
{{ $category['name'] }}
</button>
@@ -132,33 +132,33 @@
<template x-for="icon in filteredIcons" :key="icon.name">
<button
@click="selected = icon.component; open = false;"
:class="selected === icon.component ? 'ring-2 ring-primary bg-primary/10' : 'hover:bg-neutral/10'"
class="flex items-center justify-center p-3 rounded-lg transition-colors"
:class="selected === icon.component ? 'ring-2 ring-primary bg-primary/10' : 'hover:bg-muted'"
class="flex items-center justify-center p-3 rounded-lg transition-colors duration-150"
:title="icon.name"
>
<x-dynamic-component x-bind:component="icon.component" class="size-6 text-base" />
<x-dynamic-component x-bind:component="icon.component" class="size-6" />
</button>
</template>
</div>
<!-- Empty State -->
<div x-show="filteredIcons.length === 0" class="py-8 text-center">
<x-ri-search-line class="size-12 mx-auto text-base/20 mb-3" />
<p class="text-sm text-base/50">No icons found matching your search.</p>
<x-ri-search-line class="size-12 mx-auto text-muted-foreground/30 mb-3" />
<p class="text-sm text-muted-foreground">No icons found matching your search.</p>
</div>
</div>
<!-- Footer -->
<div class="p-4 border-t border-neutral/10 flex items-center justify-between">
<div class="p-4 border-t flex items-center justify-between">
<button
@click="selected = null"
class="px-3 py-1.5 text-sm text-base/60 hover:text-base"
class="px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors duration-150"
>
Clear Selection
</button>
<button
@click="open = false"
class="px-4 py-2 bg-primary text-white rounded-lg text-sm font-medium hover:bg-primary/90 transition-colors"
class="px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:bg-primary/90 transition-colors duration-150"
>
Done
</button>