double
pfqgauxfb 2 months ago
parent 481100687b
commit c6b6b2a109

@ -20,10 +20,10 @@ export default function DocRating({ docId }) {
setShowMessage(true); setShowMessage(true);
setHasRated(true); setHasRated(true);
// 3秒后隐藏消息 // 5秒后隐藏消息
setTimeout(() => { setTimeout(() => {
setShowMessage(false); setShowMessage(false);
}, 3000); }, 5000);
}; };
if (hasRated) { if (hasRated) {
@ -31,27 +31,32 @@ export default function DocRating({ docId }) {
} }
return ( return (
<div className={styles.ratingSection}> <>
<p className={styles.ratingText}>请您对本文档做出评价</p> <div className={styles.ratingSection}>
<div className={styles.ratingButtons}> <p className={styles.ratingText}>请您对本文档做出评价</p>
<button <div className={styles.ratingButtons}>
onClick={() => handleRating(true)} <button
className={`${styles.ratingButton} ${styles.positiveButton}`} onClick={() => handleRating(true)}
> className={`${styles.ratingButton} ${styles.positiveButton}`}
>
</button>
<button </button>
onClick={() => handleRating(false)} <button
className={`${styles.ratingButton} ${styles.negativeButton}`} onClick={() => handleRating(false)}
> className={`${styles.ratingButton} ${styles.negativeButton}`}
不好 >
</button> 不好
</button>
</div>
</div> </div>
{showMessage && ( {showMessage && (
<div className={styles.message}> <>
{message} <div className={styles.messageOverlay} />
</div> <div className={styles.message}>
{message}
</div>
</>
)} )}
</div> </>
); );
} }

@ -48,22 +48,42 @@
transform: translateY(-1px); transform: translateY(-1px);
} }
.messageOverlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
animation: fadeIn 0.3s ease;
}
.message { .message {
margin-top: 1rem; position: fixed;
padding: 0.75rem; top: 50%;
border-radius: 6px; left: 50%;
background-color: var(--ifm-color-emphasis-100); transform: translate(-50%, -50%);
padding: 1.5rem 2rem;
border-radius: 8px;
background-color: var(--ifm-background-color);
color: var(--ifm-color-emphasis-800); color: var(--ifm-color-emphasis-800);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
font-size: 1.1rem;
text-align: center;
min-width: 300px;
border: 1px solid var(--ifm-color-emphasis-200);
animation: fadeIn 0.3s ease; animation: fadeIn 0.3s ease;
} }
@keyframes fadeIn { @keyframes fadeIn {
from { from {
opacity: 0; opacity: 0;
transform: translateY(-10px); transform: translate(-50%, -40%);
} }
to { to {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translate(-50%, -50%);
} }
} }
Loading…
Cancel
Save