Browse Source

fix type colors

AykutSarac 2 years ago
parent
commit
733ecd1cf5
2 changed files with 4 additions and 3 deletions
  1. 1 0
      src/components/CustomNode/ObjectNode.tsx
  2. 3 3
      src/components/CustomNode/styles.tsx

+ 1 - 0
src/components/CustomNode/ObjectNode.tsx

@@ -14,6 +14,7 @@ const ObjectNode: React.FC<CustomNodeProps> = ({ node, x, y }) => {
         return (
           <Styled.StyledRow
             data-key={JSON.stringify(val)}
+            data-type={JSON.stringify(val[1])}
             data-x={x}
             data-y={y + idx * 17.8}
             key={idx}

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

@@ -81,13 +81,13 @@ export const StyledKey = styled.span<{
 `;
 
 export const StyledRow = styled.span.attrs<{
-  "data-key": string;
+  "data-type": string;
   theme: DefaultTheme;
 }>(props => ({
   style: {
-    color: getTypeColor(props["data-key"], props.theme),
+    color: getTypeColor(props["data-type"], props.theme),
   },
-}))<{ "data-key": string; theme: DefaultTheme }>`
+}))<{ "data-type": string; theme: DefaultTheme }>`
   display: block;
   height: 18px;
   overflow: hidden;