Refactor modal close behavior and improve styling
- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals. - Updated various modal button styles for consistency and improved accessibility. - Adjusted transition durations for modal animations to enhance user experience. - Added aria-labels to close buttons for better screen reader support.
This commit is contained in:
@@ -41,15 +41,15 @@
|
||||
<button
|
||||
type="button"
|
||||
@click="open = true"
|
||||
class="flex items-center gap-2 px-3 py-2 bg-background dark:bg-gray-800 border border-neutral dark:border-gray-600 rounded-lg shadow-sm hover:bg-background-secondary dark:hover:bg-gray-700 hover:border-secondary/40 transition-all duration-200"
|
||||
class="flex items-center gap-2 px-3 py-2 bg-background border border-neutral rounded-lg shadow-sm hover:bg-background-secondary hover:border-secondary/40 transition-all duration-200"
|
||||
>
|
||||
<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-secondary dark:text-gray-400" />
|
||||
<x-ri-image-add-line class="size-5 text-secondary" />
|
||||
</template>
|
||||
<span class="text-sm text-secondary dark:text-gray-300">Select Icon</span>
|
||||
<span class="text-sm text-secondary">Select Icon</span>
|
||||
</button>
|
||||
|
||||
<!-- Modal -->
|
||||
@@ -82,15 +82,15 @@
|
||||
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 w-full max-w-2xl bg-background dark:bg-gray-800 border border-neutral dark:border-gray-700 rounded-lg shadow-xl max-h-[80vh] overflow-hidden"
|
||||
class="relative w-full max-w-2xl bg-background border border-neutral rounded-lg shadow-xl max-h-[80vh] overflow-hidden"
|
||||
>
|
||||
<!-- Header -->
|
||||
<div class="p-4 border-b border-neutral dark:border-gray-700">
|
||||
<div class="p-4 border-b border-neutral">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h3 class="text-lg font-semibold text-primary dark:text-gray-100">Select Icon</h3>
|
||||
<h3 class="text-lg font-semibold text-primary">Select Icon</h3>
|
||||
<button
|
||||
@click="open = false"
|
||||
class="p-1.5 rounded-md text-secondary dark:text-gray-400 bg-transparent border-none hover:bg-background-secondary dark:hover:bg-gray-700 hover:text-primary dark:hover:text-gray-100 transition-all duration-200 cursor-pointer"
|
||||
class="p-1.5 rounded-md text-secondary bg-transparent border-none hover:bg-background-secondary hover:text-primary transition-all duration-200 cursor-pointer"
|
||||
>
|
||||
<x-ri-close-line class="size-5" />
|
||||
</button>
|
||||
@@ -98,22 +98,22 @@
|
||||
|
||||
<!-- Search -->
|
||||
<div class="relative">
|
||||
<x-ri-search-line class="absolute left-3 top-1/2 -translate-y-1/2 size-4 text-secondary dark:text-gray-400" />
|
||||
<x-ri-search-line class="absolute left-3 top-1/2 -translate-y-1/2 size-4 text-secondary" />
|
||||
<input
|
||||
type="text"
|
||||
x-model="search"
|
||||
placeholder="Search icons..."
|
||||
class="w-full pl-10 pr-3 py-2.5 text-sm text-primary dark:text-gray-100 bg-background dark:bg-gray-900 border border-neutral dark:border-gray-600 rounded-lg placeholder:text-secondary/50 dark:placeholder:text-gray-500 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/25 transition-all duration-150"
|
||||
class="w-full pl-10 pr-3 py-2.5 text-sm text-primary bg-background border border-neutral rounded-lg placeholder:text-secondary/50 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/25 transition-all duration-150"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Categories -->
|
||||
@if(count($categories) > 0)
|
||||
<div class="flex gap-2 p-4 border-b border-neutral dark:border-gray-700 overflow-x-auto">
|
||||
<div class="flex gap-2 p-4 border-b border-neutral overflow-x-auto">
|
||||
<button
|
||||
@click="activeCategory = 'all'"
|
||||
:class="activeCategory === 'all' ? 'bg-primary text-white' : 'bg-background-secondary dark:bg-gray-700 text-secondary dark:text-gray-300'"
|
||||
:class="activeCategory === 'all' ? 'bg-primary text-white' : 'bg-background-secondary text-secondary'"
|
||||
class="px-3 py-1.5 rounded-full text-xs font-medium border-none cursor-pointer whitespace-nowrap transition-all duration-200"
|
||||
>
|
||||
All
|
||||
@@ -121,7 +121,7 @@
|
||||
@foreach($categories as $category)
|
||||
<button
|
||||
@click="activeCategory = '{{ $category['id'] }}'"
|
||||
:class="activeCategory === '{{ $category['id'] }}' ? 'bg-primary text-white' : 'bg-background-secondary dark:bg-gray-700 text-secondary dark:text-gray-300'"
|
||||
:class="activeCategory === '{{ $category['id'] }}' ? 'bg-primary text-white' : 'bg-background-secondary text-secondary'"
|
||||
class="px-3 py-1.5 rounded-full text-xs font-medium border-none cursor-pointer whitespace-nowrap transition-all duration-200"
|
||||
>
|
||||
{{ $category['name'] }}
|
||||
@@ -136,7 +136,7 @@
|
||||
<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-background-secondary dark:hover:bg-gray-700'"
|
||||
:class="selected === icon.component ? 'ring-2 ring-primary bg-primary/10' : 'hover:bg-background-secondary'"
|
||||
class="flex items-center justify-center p-3 rounded-lg border-none bg-transparent cursor-pointer transition-all duration-150"
|
||||
:title="icon.name"
|
||||
>
|
||||
@@ -148,15 +148,15 @@
|
||||
<!-- Empty State -->
|
||||
<div x-show="filteredIcons.length === 0" class="py-8 text-center">
|
||||
<x-ri-search-line class="w-12 h-12 mx-auto mb-3 text-neutral" />
|
||||
<p class="text-sm text-secondary dark:text-gray-400">No icons found matching your search.</p>
|
||||
<p class="text-sm text-secondary">No icons found matching your search.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="p-4 border-t border-neutral dark:border-gray-700 flex items-center justify-between">
|
||||
<div class="p-4 border-t border-neutral flex items-center justify-between">
|
||||
<button
|
||||
@click="selected = null"
|
||||
class="px-3 py-1.5 text-sm text-secondary dark:text-gray-400 bg-transparent border-none cursor-pointer hover:text-primary dark:hover:text-gray-200 transition-colors duration-200"
|
||||
class="px-3 py-1.5 text-sm text-secondary bg-transparent border-none cursor-pointer hover:text-primary transition-colors duration-200"
|
||||
>
|
||||
Clear Selection
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user