File size: 1,667 Bytes
38bc0dc | 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 50 51 52 53 54 | import Editor from "react-simple-code-editor";
import Prism from "prismjs";
import "prismjs/components/prism-python";
import { motion, AnimatePresence } from "framer-motion";
interface CodeEditorProps {
code: string;
onChange: (code: string) => void;
scanning: boolean;
}
export default function CodeEditor({ code, onChange, scanning }: CodeEditorProps) {
return (
<div className="editor-inner">
<div className="editor-header">
<span className="glow-text-copper editor-title aberrate">// SOURCE.py</span>
<span className="editor-subtitle">
{scanning ? "SCANNING STRUCTURE…" : "paste python to analyze"}
</span>
</div>
<div className="editor-body">
<Editor
value={code}
onValueChange={onChange}
highlight={(src) => Prism.highlight(src, Prism.languages.python, "python")}
padding={16}
style={{
fontFamily: "var(--font-mono)",
fontSize: 14,
minHeight: 260,
color: "var(--text-primary)",
}}
/>
<AnimatePresence>
{scanning && (
<motion.div
key="laser"
className="scan-laser"
initial={{ top: "0%", opacity: 0 }}
animate={{ top: ["0%", "100%"], opacity: 1 }}
exit={{ opacity: 0 }}
transition={{
top: { duration: 1.1, repeat: Infinity, ease: "linear" },
opacity: { duration: 0.2 },
}}
/>
)}
</AnimatePresence>
{scanning && <div className="scan-tint" />}
</div>
</div>
);
}
|