feat(kitty): provide id in context

This commit is contained in:
Pihkaal
2024-05-30 23:53:24 +02:00
parent 9c4eaff5f4
commit 186580cccb
2 changed files with 4 additions and 4 deletions

View File

@@ -52,8 +52,8 @@ export const Kitty = (props: {
setWidth(`${width}px`); setWidth(`${width}px`);
setHeight(`${height}px`); setHeight(`${height}px`);
setContext((ctx) => ({ ...(ctx ?? { active: false }), rows, cols })); setContext({ id, rows, cols });
}, []); }, [id]);
useEffect(() => { useEffect(() => {
if (!container.current) return; if (!container.current) return;
@@ -71,7 +71,7 @@ export const Kitty = (props: {
<div className={props.className} onMouseEnter={handleMouseEnter}> <div className={props.className} onMouseEnter={handleMouseEnter}>
<div <div
className={ className={
"h-full w-full overflow-hidden rounded-lg border-2 border-borderInactive bg-background bg-opacity-80 px-[1px] text-lg text-color7 text-foreground shadow-window transition-colors duration-[500ms] ease-out" "h-full w-full overflow-hidden rounded-lg border-2 border-borderInactive bg-background bg-opacity-80 px-[1px] text-lg text-[#cbc7d1] text-foreground shadow-window transition-colors duration-[500ms] ease-out"
} }
style={{ style={{
lineHeight: `${CHAR_HEIGHT}px`, lineHeight: `${CHAR_HEIGHT}px`,

View File

@@ -7,5 +7,5 @@ export const KittyContext = createContext<KittyContextProps | undefined>(
export type KittyContextProps = { export type KittyContextProps = {
rows: number; rows: number;
cols: number; cols: number;
active: boolean; id: string;
}; };