From 68444945efc9897707a7a65cea498cc72a36fe91 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 25 Jul 2024 11:22:32 +0200 Subject: [PATCH] fix(kitty): wrong height --- src/components/Kitty.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Kitty.tsx b/src/components/Kitty.tsx index f099705..7026316 100644 --- a/src/components/Kitty.tsx +++ b/src/components/Kitty.tsx @@ -5,6 +5,7 @@ import { useState, useCallback, useId, + type HTMLAttributes, } from "react"; import { type KittyContextProps } from "~/context/KittyContext"; import { useApp } from "~/hooks/useApp"; @@ -45,6 +46,7 @@ export const Kitty = (props: { const cols = Math.round( (container.current.clientWidth - PADDING_RIGHT) / CHAR_WIDTH, ); + const rows = Math.round(container.current.clientHeight / CHAR_HEIGHT); const width = cols * CHAR_WIDTH; @@ -67,6 +69,10 @@ export const Kitty = (props: { }; }, [snapToCharacter]); + const style: HTMLAttributes["style"] = props.rows + ? { height } + : { maxHeight: height, height: "100%" }; + return (
{props.children}