Selaa lähdekoodia

style search node

AykutSarac 2 vuotta sitten
vanhempi
commit
98b56deaa5
3 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. 2 2
      src/components/CustomNode/styles.tsx
  2. 1 1
      src/hooks/useFocusNode.tsx
  3. 3 3
      src/utils/search.ts

+ 2 - 2
src/components/CustomNode/styles.tsx

@@ -34,8 +34,8 @@ export const StyledForeignObject = styled.foreignObject<{
   }
   }
 
 
   .highlight {
   .highlight {
-    background-color: rgba(255, 0, 255, 0.5);
-    filter: hue-rotate();
+    border: 2px dashed #FF2970;
+    background: rgba(255, 214, 0, 0.3);
   }
   }
 
 
   .renderVisible {
   .renderVisible {

+ 1 - 1
src/hooks/useFocusNode.tsx

@@ -23,7 +23,7 @@ export const useFocusNode = () => {
 
 
     const debouncer = setTimeout(() => {
     const debouncer = setTimeout(() => {
       setContent((val) => ({ ...val, debounced: content.value }));
       setContent((val) => ({ ...val, debounced: content.value }));
-    }, 1500);
+    }, 800);
 
 
     return () => clearTimeout(debouncer);
     return () => clearTimeout(debouncer);
   }, [content.value, setConfig]);
   }, [content.value, setConfig]);

+ 3 - 3
src/utils/search.ts

@@ -16,9 +16,9 @@ export const highlightMatchedNodes = (
   selectedNode: number
   selectedNode: number
 ) => {
 ) => {
   nodes?.forEach((node) => {
   nodes?.forEach((node) => {
-    node.parentElement?.parentElement
-      ?.closest("foreignObject")
-      ?.classList.add("searched");
+    console.log(node.parentElement?.closest("foreignObject"));
+
+    node.parentElement?.closest("foreignObject")?.classList.add("searched");
   });
   });
 
 
   nodes[selectedNode].classList.add("highlight");
   nodes[selectedNode].classList.add("highlight");