ProzillaOS/packages/apps/terminal/components/OutputLine.tsx
2024-06-16 21:46:44 +02:00

17 lines
No EOL
480 B
TypeScript

import { FC, forwardRef } from "react";
import { Ansi } from "./Ansi";
import styles from "./Terminal.module.css";
interface OutputLineProps {
text?: string;
}
export const OutputLine: FC<OutputLineProps> = forwardRef<HTMLDivElement>(({ text }: OutputLineProps, ref) => {
const lines = text?.split("\n");
return <div ref={ref}>
{lines?.map((line, index) =>
<Ansi key={index} className={styles.Output} useClasses>{line === "" ? " " : line}</Ansi>
)}
</div>;
}) as FC;