From 089c29b57969cdd0acf093f49b6c1daf16c1d030 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 25 Jan 2024 20:38:42 +0100 Subject: [PATCH] fix(terminal): rename height -> rows --- src/components/Terminal.tsx | 7 +++++-- src/components/Text.tsx | 1 - src/context/TerminalContext.tsx | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Terminal.tsx b/src/components/Terminal.tsx index b2046ca..71a05fb 100644 --- a/src/components/Terminal.tsx +++ b/src/components/Terminal.tsx @@ -8,7 +8,10 @@ export const Terminal = (props: { }) => { const terminalRef = useRef(null); - const [size, setSize] = useState<{ cols: number; rows: number }>(); + const [size, setSize] = useState<{ cols: number; rows: number }>({ + cols: -1, + rows: -1, + }); useEffect(() => { const precision = 300; @@ -55,7 +58,7 @@ export const Terminal = (props: { )} style={{ backdropFilter: "blur(2px)" }} > - {size && props.children} + {size.cols > -1 && props.children} ); diff --git a/src/components/Text.tsx b/src/components/Text.tsx index 6fae73d..d7c659f 100644 --- a/src/components/Text.tsx +++ b/src/components/Text.tsx @@ -21,4 +21,3 @@ export const Text = (props: { {props.children} ); - diff --git a/src/context/TerminalContext.tsx b/src/context/TerminalContext.tsx index fc5ba9c..66f4f68 100644 --- a/src/context/TerminalContext.tsx +++ b/src/context/TerminalContext.tsx @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; -const TerminalContext = createContext<{ cols: number; height: number } | null>( +const TerminalContext = createContext<{ cols: number; rows: number } | null>( null, );