From 5b0b8c222442e89ceb32f8bd10848b826b834a59 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 7 Oct 2024 00:28:54 -0400 Subject: [PATCH] working on some text logic playing with ideas --- src/components/InfinateCanvas.tsx | 2 ++ src/components/TextItem.tsx | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/InfinateCanvas.tsx b/src/components/InfinateCanvas.tsx index 116f76a..e446906 100644 --- a/src/components/InfinateCanvas.tsx +++ b/src/components/InfinateCanvas.tsx @@ -8,6 +8,7 @@ import images from "../signals/images" import { CardSelector } from "./cardSelector/CardSelector" import { isTheme } from "../utils/isTheme" import { TextItem } from "./TextItem" +import texts from "../signals/texts" export default function InfiniteCanvas() { const containerRef = useRef(null) @@ -29,6 +30,7 @@ export default function InfiniteCanvas() { window.addEventListener("resize", updateDimensions) notes.loadLocalStorage() images.loadLocalStorage() + texts.loadLocalStorage() return () => { window.removeEventListener("resize", updateDimensions) diff --git a/src/components/TextItem.tsx b/src/components/TextItem.tsx index e7a834b..7e1775a 100644 --- a/src/components/TextItem.tsx +++ b/src/components/TextItem.tsx @@ -3,6 +3,7 @@ import { TextSignal, focusedItem } from "../signals" import { useDebounce } from "../utils/useDebounce" import texts, { TextCardType } from "../signals/texts" import { LayerEnum } from "../utils/enums" +import { isTheme } from "../utils/isTheme" namespace TextItem { export interface TextCardProps { @@ -87,20 +88,19 @@ export function TextItem({ key: itemKey, data: item }: TextItem.TextCardProps) { return (
focusedItem.value = itemKey} - className="select-none transition flex flex-col justify-stretch shadow-lg rounded border border-[#3c3c3c] absolute border-dashed" + onmousedown={_handleMouseDown} + className="select-none transition flex flex-col justify-stretch rounded border border-[#3c3c3c] absolute border-dashed" style={{ zIndex: `${focusedItem.value == itemKey ? LayerEnum.CARD_ELEVATED : LayerEnum.CARD}`, width: `${item.dimensions.w}px`, - height: `${item.dimensions.h}px`, + height: `${item.dimensions.h + 100}px`, top: `${item.position.y}px`, left: `${item.position.x}px`, }} > - - {item.contents} - - +
+

{item.contents}

+
)