Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional styling on tooltips not possible #31

Open
blaur opened this issue Jun 15, 2021 · 0 comments
Open

Conditional styling on tooltips not possible #31

blaur opened this issue Jun 15, 2021 · 0 comments

Comments

@blaur
Copy link

blaur commented Jun 15, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant