Skip to content

Conditional styling on tooltips not possible #31

@blaur

Description

@blaur

The following is our conditional tooltip styling:

// Tooltips
const tooltipRenders = graphPerformanceMetrics
   ? [formatDate, formatPrice]
   : [formatDate];

// Styles
const tooltipStyling = graphPerformanceMetrics
   ? [
       {
         fontFamily: Font.Poppins_Regular,
         color: Colors.primaryFontColor,
       },
       {
         fontFamily: Font.Poppins_Regular,
         color:
           graphPerformanceMetrics.absDelta > 0
             ? Colors.primaryGreen
             : Colors.secondaryRed,
       },
     ]
   : [
       {
         fontFamily: Font.Poppins_Regular,
         color: Colors.primaryFontColor,
       },
     ];

From our end it looks correct but what is rendered is wrong. It seems like it switches around or somehow uses the previous value and not updating the styles in real time.

What I am seeing:

  • When abs delta > 0 then it shows with red color
  • When abs delta < 0 then it shows green

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions