import "./Code.css"; import copy from "clipboard-copy"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark } from "react-syntax-highlighter/dist/esm/styles/prism"; const TitleBarButton = (id: string) => (
); const TitleBarButtons = () => { const titleBarButtons = ["close", "minimize", "maximize"]; return (
{titleBarButtons.map(TitleBarButton)}
); }; interface TitleBarProps { title?: string; code: string; } const TitleBar = ({ title, code }: TitleBarProps) => (
{title}
); interface LineNumbersProps { code: string; } const LineNumbers = ({ code }: LineNumbersProps) => { const count = code.split("\n").length; const numbers = []; for (let i = 1; i <= count; i++) numbers.push(i); return ( ); }; interface CodeProps { title?: string; code: string; language?: string; } const Code = ({ title, code, language = "javascript" }: CodeProps) => (
{code}
); export default Code;