11import React , { useEffect } from 'react' ;
2- import { X } from '@phosphor-icons/react' ;
2+ import { X , Code } from '@phosphor-icons/react' ;
33import { motion , AnimatePresence } from 'framer-motion' ;
44import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' ;
55import { customTheme } from '../utils/customTheme' ;
6+ import GenerativeArt from './GenerativeArt' ;
67
78const CodeModal = ( { isOpen, onClose, children, language } ) => {
89 useEffect ( ( ) => {
@@ -20,37 +21,75 @@ const CodeModal = ({ isOpen, onClose, children, language }) => {
2021 < AnimatePresence >
2122 { isOpen && (
2223 < motion . div
23- className = "fixed inset-0 bg-black bg-opacity-75 flex justify-center items-center z-50 p-4"
24+ className = "fixed inset-0 bg-black/90 backdrop-blur-sm flex justify-center items-center z-50 p-4 md:p-8 "
2425 onClick = { onClose }
2526 initial = { { opacity : 0 } }
2627 animate = { { opacity : 1 } }
2728 exit = { { opacity : 0 } }
2829 >
2930 < motion . div
30- className = "relative bg-gray-800 rounded-lg shadow-lg p-6 w-3/4 h-3/4 prose prose-xl prose-dark max-w-none "
31+ className = "relative bg-[#050505] border border-white/10 rounded-sm shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden group "
3132 onClick = { ( e ) => e . stopPropagation ( ) }
32- initial = { { scale : 0.8 , opacity : 0 } }
33- animate = { { scale : 1 , opacity : 1 } }
34- exit = { { scale : 0.8 , opacity : 0 } }
35- transition = { { duration : 0.2 } }
33+ initial = { { scale : 0.95 , opacity : 0 , y : 20 } }
34+ animate = { { scale : 1 , opacity : 1 , y : 0 } }
35+ exit = { { scale : 0.95 , opacity : 0 , y : 20 } }
36+ transition = { { duration : 0.3 , ease : 'circOut' } }
3637 >
37- < button
38- onClick = { onClose }
39- className = "absolute top-2 right-2 text-white text-2xl bg-gray-800 rounded-full p-2 hover:bg-gray-700 focus:outline-none"
40- >
41- < X size = { 24 } weight = "bold" />
42- </ button >
43- < SyntaxHighlighter
44- style = { customTheme }
45- language = { language }
46- PreTag = "pre"
47- className = "overflow-auto h-full"
48- codeTagProps = { {
49- style : { fontFamily : "'JetBrains Mono', monospace" } ,
50- } }
51- >
52- { children }
53- </ SyntaxHighlighter >
38+ { /* Background Art */ }
39+ < div className = "absolute inset-0 opacity-[0.03] pointer-events-none" >
40+ < GenerativeArt seed = "CODE_MODAL" className = "w-full h-full" />
41+ </ div >
42+ { /* Header */ }
43+ < div className = "flex items-center justify-between px-6 py-4 border-b border-white/10 bg-white/[0.02] z-10" >
44+ < div className = "flex items-center gap-3" >
45+ < Code size = { 20 } className = "text-emerald-500" weight = "fill" />
46+ < span className = "font-mono text-xs font-bold uppercase tracking-[0.2em] text-gray-400" >
47+ Code_Viewer
48+ < span className = "text-gray-600 mx-2" > ::</ span >
49+ < span className = "text-emerald-500" > { language || 'TEXT' } </ span >
50+ </ span >
51+ </ div >
52+ < button
53+ onClick = { onClose }
54+ className = "group p-2 hover:bg-red-500/10 border border-transparent hover:border-red-500/50 transition-all rounded-sm"
55+ >
56+ < X size = { 20 } className = "text-gray-500 group-hover:text-red-500 transition-colors" />
57+ </ button >
58+ </ div >
59+
60+ { /* Content */ }
61+ < div className = "flex-1 overflow-auto relative z-10 custom-scrollbar bg-black/40" >
62+ < SyntaxHighlighter
63+ style = { customTheme }
64+ language = { language }
65+ PreTag = "div"
66+ className = "!bg-transparent !p-6 !m-0 h-full !font-mono !text-sm md:!text-base"
67+ showLineNumbers = { true }
68+ lineNumberStyle = { {
69+ minWidth : '2.5em' ,
70+ paddingRight : '1.5em' ,
71+ color : '#333' ,
72+ textAlign : 'right' ,
73+ fontFamily : '"JetBrains Mono", monospace'
74+ } }
75+ codeTagProps = { {
76+ style : { fontFamily : "'JetBrains Mono', monospace" } ,
77+ } }
78+ >
79+ { children }
80+ </ SyntaxHighlighter >
81+ </ div >
82+
83+ { /* Footer Status Bar */ }
84+ < div className = "px-6 py-2 border-t border-white/10 bg-white/[0.02] flex justify-between items-center z-10" >
85+ < span className = "font-mono text-[10px] text-gray-600 uppercase tracking-widest" >
86+ ReadOnly Mode
87+ </ span >
88+ < span className = "font-mono text-[10px] text-emerald-500/50 uppercase tracking-widest" >
89+ • Connected
90+ </ span >
91+ </ div >
92+
5493 </ motion . div >
5594 </ motion . div >
5695 ) }
0 commit comments