Files
cc-switch/src/renderer/components/MessageModal.tsx
T
farion1231 48dcb23ea5 用 Modal 组件替换所有 alert 弹窗
- 创建 ConfirmModal 和 MessageModal 组件
- 更新 App.tsx 使用新的 Modal 组件
- 改进表单验证错误显示
- 提升用户体验和界面一致性
2025-08-06 07:44:50 +08:00

44 lines
910 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React from 'react'
import './AddProviderModal.css'
interface MessageModalProps {
title: string
message: string
type?: 'success' | 'error' | 'info'
onClose: () => void
}
const MessageModal: React.FC<MessageModalProps> = ({
title,
message,
type = 'info',
onClose
}) => {
const getIcon = () => {
switch (type) {
case 'success':
return '✅'
case 'error':
return '❌'
default:
return '️'
}
}
return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal-content" onClick={(e) => e.stopPropagation()}>
<h2>{getIcon()} {title}</h2>
<p>{message}</p>
<div className="form-actions">
<button type="button" className="submit-btn" onClick={onClose}>
</button>
</div>
</div>
</div>
)
}
export default MessageModal