mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
Fix modal width with proper CSS media queries
Previous approach used invalid inline styles with @media queries, which browsers ignore. Now using: - Unique modal ID generated with PHP uniqid() - <style> tag with proper CSS media queries - ID selector for scoped styling This properly constrains modal width on large screens while keeping full width on mobile. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,23 @@
|
||||
'maxWidth' => '48rem',
|
||||
'isFullWidth' => false,
|
||||
])
|
||||
|
||||
@php
|
||||
$modalId = 'modal-' . uniqid();
|
||||
@endphp
|
||||
|
||||
<style>
|
||||
#{{ $modalId }} {
|
||||
max-height: calc(100vh - 2rem);
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
#{{ $modalId }} {
|
||||
min-width: {{ $minWidth }};
|
||||
max-width: {{ $maxWidth }};
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div x-data="{ modalOpen: false }"
|
||||
x-init="$watch('modalOpen', value => { if (!value) { $wire.dispatch('modalClosed') } })"
|
||||
:class="{ 'z-40': modalOpen }" @keydown.window.escape="modalOpen=false"
|
||||
@@ -39,14 +56,13 @@
|
||||
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0"
|
||||
@if ($closeOutside) @click="modalOpen=false" @endif
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen"
|
||||
<div id="{{ $modalId }}" x-show="modalOpen" x-trap.inert.noscroll="modalOpen"
|
||||
x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
style="max-height: calc(100vh - 2rem); @media (min-width: 1024px) { min-width: {{ $minWidth }}; max-width: {{ $maxWidth }}; }"
|
||||
class="relative w-full border rounded-sm drop-shadow-sm min-w-full bg-white border-neutral-200 dark:bg-base dark:border-coolgray-300 flex flex-col">
|
||||
<div class="flex items-center justify-between py-6 px-6 shrink-0">
|
||||
<h3 class="text-2xl font-bold">{{ $title }}</h3>
|
||||
|
||||
Reference in New Issue
Block a user