fix(k8s): YAML 弹框 Portal 到 body 修复居中偏移

PageTransition 的 transform 会使 fixed 弹框相对页面定位而非视口,
YamlViewer 尺寸较大时容易跑出可视区。统一用 ModalOverlay Portal。
This commit is contained in:
Logan.Li committed 2026-06-26 15:04:08 +08:00
1 parent 025e74ff4d
commit 729f25e068
4 files changed
+42 -9

No files matched your search

@@ -2,6 +2,7 @@
import { useState, useEffect, useCallback } from 'react';
import { X, Save, Loader2, Plus, Trash2, FileText, Network, Shield, Database, ChevronRight} from 'lucide-react';
import { Button } from '@/components/ui/button';
import { ModalOverlay } from '@/components/ui/modal-overlay';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
@@ -132,8 +133,11 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
const MetaIcon = meta.icon;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60" onClick={onClose}>
<div className="bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl" onClick={e => e.stopPropagation()}>
<ModalOverlay onClose={onClose}>
<div
className="bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl"
onClick={(e) => e.stopPropagation()}
>
{/* Header */}
<div className="flex items-center justify-between p-4 border-b border-[var(--dg-border)]">
<div className="flex items-center gap-2">
@@ -206,7 +210,7 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
)}
</div>
</div>
</div>
</ModalOverlay>
);
}