Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

[Preview] show small values in a tooltip #3966

Description

@jasonLaster

It would be nice if simple values like strings and numbers that are smaller than 10 characters used the tooltip.

See the GIF below. 0 and " " have the popup when they'd look good in the tooltip.

Here is a small sample

diff --git a/src/components/Editor/Preview/Popup.js b/src/components/Editor/Preview/Popup.js
index 8c4057a..7cf0845 100644
--- a/src/components/Editor/Preview/Popup.js
+++ b/src/components/Editor/Preview/Popup.js
@@ -164,6 +164,15 @@ export class Popup extends Component {
       return this.renderFunctionPreview(value, root);
     }

+    // we can check here to see what we want to do...
+
+    const isSmallString = value.type == "string" && value.x.length < 10;
+    const isSmallNumber = value.type == "number" && value.x.toString().length < 10;
+
+    if (isSmallNumber || isSmallString) {
+      return this.renderSimplePreview(value);
+    }
+
     if (value.type === "object") {
       return (
         <div>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Jira

    None yet

    Severity

    None yet

    Estimate

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions