feat(kitty): provide id in context
This commit is contained in:
@@ -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`,
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user