Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import React from 'react'; import { AchievementData } from '../types'; interface AchievementModalProps { show: boolean; achievement: AchievementData | null; onClose: () => void; } const AchievementModal: React.FC<AchievementModalProps> = ({ show, achievement, onClose }) => { Iif (!show || !achievement) return null; const modalStyle: React.CSSProperties = { position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', backgroundColor: '#fff', padding: '20px', borderRadius: '8px', boxShadow: '0 0 10px rgba(0,0,0,0.1)', zIndex: 1000, }; const overlayStyle: React.CSSProperties = { position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, backgroundColor: 'rgba(0,0,0,0.5)', zIndex: 999, }; return ( <> <div style={overlayStyle} onClick={onClose} /> <div style={modalStyle} role="dialog" aria-modal="true" aria-labelledby="achievement-title"> <h2 id="achievement-title">Achievement Unlocked!</h2> <img src={achievement.icon} alt={achievement.title} style={{ width: '50px', height: '50px' }} /> <h3>{achievement.title}</h3> <p>{achievement.description}</p> <button onClick={onClose}>Okay</button> </div> </> ); }; export default React.memo(AchievementModal); |