-
Notifications
You must be signed in to change notification settings - Fork 14k
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
feat(css): adds chartId
-based class to dashboard chart holder
#19873
Conversation
@samtfm you may remember this from ages ago... feel free to review, or request changes/additions |
chartId
-based class to dashboard chart holderchartId
-based class to dashboard chart holder
Codecov Report
@@ Coverage Diff @@
## master #19873 +/- ##
===========================================
+ Coverage 53.91% 66.33% +12.42%
===========================================
Files 1713 1713
Lines 64995 64083 -912
Branches 6698 6734 +36
===========================================
+ Hits 35040 42509 +7469
+ Misses 28248 19863 -8385
- Partials 1707 1711 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Should we add a comment in the code with the reasoning to prevent anyone in the future to delete this class because it's not being used? |
superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx
Show resolved
Hide resolved
Excellent suggestion! Thank you for that. I added one, so if it seems sufficiently explanatory, I'd love a (re)review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, I like the idea of leaning into the custom css feature by offering official supported hooks and documenting them somewhere.
…he#19873) * feat: adds `chartId`-based class to dashboard chart holder * Adding comment to denote the purpose of the class in the code.
SUMMARY
This PR adds a class to all dashboard charts, referencing their
chartID
asdashboard-chart-id-{X}
as seen here:This allows you to more reliably target a particular chart and do wacky CSS things with it, like so:
What you do with this new found power is up to you, and at your own risk... but it's easier to do it for a particular chart now, anyway, even if someone moves charts around on a dashboard, which was the main point of fragility in
nth-of-type
selector approaches.The world is now your oyster
TESTING INSTRUCTIONS
Poke around at it! It shouldn't cause any harm to add a new class that has no styles attached to it.
ADDITIONAL INFORMATION