Improve JsonView component styling and change to use JsonView in PromptsTab

This commit is contained in:
cgoing
2025-03-27 10:49:37 +09:00
parent 196fd67ce9
commit e6f5da8383
3 changed files with 22 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
import { useState, memo } from "react";
import { JsonValue } from "./DynamicJsonForm";
import clsx from "clsx";
interface JsonViewProps {
data: JsonValue;
@@ -70,7 +71,7 @@ const JsonNode = memo(
boolean: "text-amber-600",
null: "text-purple-600",
undefined: "text-gray-600",
string: "text-green-600",
string: "text-green-600 break-all",
default: "text-gray-700",
};
@@ -173,7 +174,7 @@ const JsonNode = memo(
{name}:
</span>
)}
<span className={typeStyleMap.string}>"{value}"</span>
<p className={typeStyleMap.string}>"{value}"</p>
</div>
);
}
@@ -186,7 +187,10 @@ const JsonNode = memo(
</span>
)}
<span
className={`${typeStyleMap.string} cursor-pointer group-hover:text-green-500`}
className={clsx(
typeStyleMap.string,
"cursor-pointer group-hover:text-green-500",
)}
onClick={() => setIsExpanded(!isExpanded)}
title={isExpanded ? "Click to collapse" : "Click to expand"}
>