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:
@@ -33,21 +33,19 @@
|
||||
<div {{ $attributes->class(['flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between group']) }}>
|
||||
<div class="flex items-start gap-3.5">
|
||||
@if($icon)
|
||||
<div style="width: 2.75rem; height: 2.75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: .5rem; background: rgba(13, 110, 253, 0.1);" class="transition-transform duration-300 group-hover:scale-105">
|
||||
<x-dynamic-component :component="$icon" class="size-5 transition-colors duration-200" style="color: #0d6efd;" />
|
||||
<div class="flex items-center justify-center w-11 h-11 flex-shrink-0 rounded-lg bg-primary/10 transition-transform duration-300 group-hover:scale-105">
|
||||
<x-dynamic-component :component="$icon" class="size-5 text-primary transition-colors duration-200" />
|
||||
</div>
|
||||
@endif
|
||||
<div style="display: flex; flex-direction: column; gap: .25rem;">
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<h2 style="{{ $titleStyle }} color: #212529; margin: 0;">{{ $title }}</h2>
|
||||
<h2 class="text-xl font-semibold" style="{{ $titleStyle }}">{{ $title }}</h2>
|
||||
@if($helpText)
|
||||
<div class="relative" x-data="{ open: false }" x-cloak>
|
||||
<button
|
||||
type="button"
|
||||
@click="open = true"
|
||||
style="color: #6c757d; transition: color .2s ease;"
|
||||
onmouseover="this.style.color='#495057'"
|
||||
onmouseout="this.style.color='#6c757d'"
|
||||
class="text-base/50 hover:text-base/70 transition-colors"
|
||||
>
|
||||
<x-ri-question-line class="size-4.5" />
|
||||
</button>
|
||||
@@ -62,8 +60,8 @@
|
||||
x-transition:leave-end="opacity-0"
|
||||
@click="open = false"
|
||||
@keydown.escape.window="open = false"
|
||||
class="fixed inset-0"
|
||||
style="z-index: 99999; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: none;"
|
||||
class="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"
|
||||
style="display: none;"
|
||||
></div>
|
||||
<div
|
||||
x-show="open"
|
||||
@@ -73,32 +71,32 @@
|
||||
x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 scale-100 translate-y-0"
|
||||
x-transition:leave-end="opacity-0 scale-95 translate-y-4"
|
||||
@click.away="open = false"
|
||||
class="fixed inset-0 flex items-center justify-center p-4"
|
||||
style="z-index: 99999; display: none;"
|
||||
@click.self="open = false"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center p-4"
|
||||
style="display: none;"
|
||||
>
|
||||
<div class="modal-lte" style="max-height: 90vh; width: 100%; max-width: 32rem; overflow-y: auto; padding: 1.5rem; background: #fff; border-radius: .375rem; box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);">
|
||||
<button @click="open = false" style="position: absolute; right: 1rem; top: 1rem; width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center; border-radius: .25rem; color: #6c757d; border: none; background: transparent; cursor: pointer; transition: background .2s ease, color .2s ease;" onmouseover="this.style.background='#f8f9fa'; this.style.color='#212529'" onmouseout="this.style.background='transparent'; this.style.color='#6c757d'">
|
||||
<div class="relative w-full max-w-2xl max-h-[90vh] overflow-y-auto bg-background-secondary rounded-xl border border-neutral/20 shadow-2xl p-6">
|
||||
<button @click="open = false" class="absolute top-4 right-4 text-base/50 hover:text-base transition-colors">
|
||||
<x-ri-close-line class="size-5" />
|
||||
</button>
|
||||
<div style="margin-bottom: 1.25rem; display: flex; align-items: center; gap: .875rem; padding-right: 2rem;">
|
||||
<div class="flex items-center gap-3 mb-4 pr-8">
|
||||
@if($icon)
|
||||
<div style="width: 2.75rem; height: 2.75rem; display: flex; align-items: center; justify-content: center; border-radius: .5rem; background: rgba(13, 110, 253, 0.1);">
|
||||
<x-dynamic-component :component="$icon" class="size-5" style="color: #0d6efd;" />
|
||||
<div class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">
|
||||
<x-dynamic-component :component="$icon" class="size-5 text-primary" />
|
||||
</div>
|
||||
@endif
|
||||
<h3 style="font-size: 1.125rem; font-weight: 600; color: #212529; margin: 0;">{{ $title }}</h3>
|
||||
<h6 class="font-sans text-lg font-semibold leading-tight">{{ $title }}</h6>
|
||||
</div>
|
||||
<div style="font-size: .875rem; color: #6c757d; line-height: 1.5;">
|
||||
<p class="block font-sans text-sm font-normal leading-relaxed text-base/75">
|
||||
{{ $helpText }}
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if($subtitle)
|
||||
<p style="font-size: .875rem; color: #6c757d; margin: 0;">{{ $subtitle }}</p>
|
||||
<p class="text-sm text-base/60">{{ $subtitle }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user