Commit ae3743ab by liimin

refactor(app): 优化外部链接对话框样式和布局

- 调整对话框面板样式,增加背景透明度和模糊效果
- 修改标题栏样式,添加关闭按钮图标
- 优化 iframe 嵌入样式,增加居中显示和最大宽度限制
- 调整错误提示样式,使用红色警告信息
- 修复关闭对话框功能,确保点击关闭按钮时正确关闭
1 parent 164d452e
...@@ -23,51 +23,56 @@ const ExternalLink: FC<LinkProps> = ({ node, children }) => { ...@@ -23,51 +23,56 @@ const ExternalLink: FC<LinkProps> = ({ node, children }) => {
{children || 'Open'} {children || 'Open'}
</a> </a>
<Dialog open={isOpen} onClose={() => setIsOpen(false)} className="relative z-50"> <Dialog open={isOpen} onClose={() => setIsOpen(false)} className="relative z-50">
<div className="fixed inset-0 bg-black/30" aria-hidden="true" /> <div className="fixed inset-0 bg-black/30" aria-hidden="true" />
<div className="fixed inset-0 flex items-center justify-center p-4"> <div className="fixed inset-0 flex items-center justify-center p-1">
<DialogPanel className="w-full max-w-[90vw] h-[80vh] bg-white rounded-lg flex flex-col"> <DialogPanel className="w-full h-full bg-gray-800/80 backdrop-blur-sm rounded-lg flex flex-col border-8 border-t-0 border-transparent">
<div className="flex justify-between items-center p-3 border-b h-12"> <div className="flex justify-between items-center border-b border-gray-600 h-8">
<DialogTitle className="text-sm font-medium">外部页面</DialogTitle> {/* <DialogTitle className="text-sm font-medium text-white/80">外部页面</DialogTitle> */}
<button onClick={() => setIsOpen(false)} className="text-gray-500 hover:text-gray-700"> <button
<span className="sr-only">关闭</span>× onClick={() => setIsOpen(false)}
</button> className="ml-auto p-1 rounded-full hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-primary-500">
</div> <span className="sr-only">关闭</span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" className="w-5 h-5 text-gray-400 hover:text-white">
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
</svg>
</button>
</div>
<div className="flex-1 relative"> <div className="flex-1 relative flex items-center justify-center">
{isLoading && ( {isLoading && (
<div className="absolute inset-0 flex items-center justify-center"> <div className="absolute inset-0 flex items-center justify-center">
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-500" /> <div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-500" />
</div> </div>
)} )}
{iframeError ? ( {iframeError ? (
<div className="absolute inset-0 flex items-center justify-center flex-col gap-2"> <div className="absolute inset-0 flex items-center justify-center flex-col gap-2">
<p className="text-red-500">该页面不支持内嵌显示</p> <p className="text-red-400">该页面不支持内嵌显示</p>
<button <button
onClick={() => window.open(node.properties.href, '_blank')} onClick={() => window.open(node.properties.href, '_blank')}
className="px-4 py-2 bg-primary-500 text-white rounded"> className="px-4 py-2 bg-primary-500 text-white rounded hover:bg-primary-600">
在浏览器中打开 在浏览器中打开
</button> </button>
</div> </div>
) : ( ) : (
<iframe <iframe
src={node.properties.href} src={node.properties.href}
className="w-full h-full border-0" className="w-full max-w-[800px] h-full border-0 mx-auto"
allow="fullscreen" allow="fullscreen"
loading="lazy" loading="lazy"
onLoad={() => setIsLoading(false)} onLoad={() => setIsLoading(false)}
onError={() => { onError={() => {
setIsLoading(false) setIsLoading(false)
setIframeError(true) setIframeError(true)
}} }}
/> />
)} )}
</div> </div>
</DialogPanel> </DialogPanel>
</div> </div>
</Dialog> </Dialog>
</> </>
) )
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!