From f4255a04ee4d37e1a6ae8fe0b0c1588055833b8b Mon Sep 17 00:00:00 2001 From: seaislee1209 Date: Mon, 23 Mar 2026 22:13:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=91=8A=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20CSS=20Module=20=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit inline style 改为 CSS Module,z-index/圆角/关闭按钮与其他弹窗统一 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../components/AnnouncementModal.module.css | 86 +++++++++++++++++++ web/src/components/AnnouncementModal.tsx | 55 +++--------- 2 files changed, 100 insertions(+), 41 deletions(-) create mode 100644 web/src/components/AnnouncementModal.module.css diff --git a/web/src/components/AnnouncementModal.module.css b/web/src/components/AnnouncementModal.module.css new file mode 100644 index 0000000..500f6e0 --- /dev/null +++ b/web/src/components/AnnouncementModal.module.css @@ -0,0 +1,86 @@ +.overlay { + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.6); + display: flex; + align-items: center; + justify-content: center; + z-index: 300; +} + +.modal { + background: #16161e; + border: 1px solid var(--color-border-card); + border-radius: var(--radius-card); + max-width: 520px; + width: 90vw; + max-height: 75vh; + display: flex; + flex-direction: column; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20px 32px 12px; + flex-shrink: 0; + border-bottom: 1px solid rgba(255, 255, 255, 0.06); +} + +.title { + font-size: 16px; + font-weight: 600; + color: var(--color-text-primary); +} + +.closeBtn { + background: none; + border: none; + color: var(--color-text-secondary); + cursor: pointer; + padding: 4px; + display: flex; + align-items: center; + transition: color 0.15s; +} + +.closeBtn:hover { + color: var(--color-text-primary); +} + +.content { + font-size: 14px; + line-height: 1.8; + color: var(--color-text-primary); + word-break: break-word; + padding: 16px 40px; + overflow-y: auto; + scrollbar-width: none; + flex: 1; +} + +.content::-webkit-scrollbar { + display: none; +} + +.footer { + text-align: center; + padding: 16px 0 20px; + flex-shrink: 0; +} + +.confirmBtn { + padding: 8px 32px; + background: var(--color-primary); + border: none; + border-radius: 8px; + color: #fff; + font-size: 14px; + cursor: pointer; + transition: opacity 0.15s; +} + +.confirmBtn:hover { + opacity: 0.85; +} diff --git a/web/src/components/AnnouncementModal.tsx b/web/src/components/AnnouncementModal.tsx index 89ff859..c1d8a63 100644 --- a/web/src/components/AnnouncementModal.tsx +++ b/web/src/components/AnnouncementModal.tsx @@ -1,5 +1,6 @@ import { useEffect, useState, useCallback } from 'react'; import { videoApi } from '../lib/api'; +import styles from './AnnouncementModal.module.css'; interface Props { /** If true, force show even if already read (for manual open) */ @@ -31,51 +32,23 @@ export function AnnouncementModal({ forceOpen, onClose }: Props) { if (!visible || !content) return null; return ( -
{ if (e.target === e.currentTarget) handleClose(); }} - > -
-
- - 📢 公告 - - +
{ if (e.target === e.currentTarget) handleClose(); }}> +
+
+ 公告 +
li{margin-left:16px}${content}` }} /> -
-