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
Create Truncation Component #1500
Conversation
operator-linebreak is no different then default quotes is overwriting prettier config
Codecov Report
@@ Coverage Diff @@
## master #1500 +/- ##
==========================================
+ Coverage 60.81% 61.62% +0.80%
==========================================
Files 35 36 +1
Lines 3325 3528 +203
==========================================
+ Hits 2022 2174 +152
- Misses 1303 1354 +51
Continue to review full report at Codecov.
|
Ahh thanks for testing the What's your thought on this Firefox discussion board's solution? I added the same test cases from the Stackoverflow one, and it seems to work better: https://codepen.io/tihuan/pen/qBbWoog And the only hard coded value is .split {
width: 300px;
background: pink;
display: flex;
overflow: hidden;
justify-content: flex-start;
}
.first {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 1;
min-width: 30px;
}
.second > span {
position: absolute;
right: 0;
color: initial;
}
.second {
color: transparent;
position: relative;
overflow: hidden;
white-space:nowrap;
} PTAL 🎉 ! UPDATE: Changed the width to |
@tihuan I think that's the one! I'm going to run it against some other datasets, but its looking good so far! |
So glad to hear that 😭 !! Thanks for your patience on this one, @seve !! If that works for our cases, I'll share the code and credit the author back to the original Stackoverflow solution, so other people can see it too 😆 |
Woot woot go @seve !! 🎉 🎉 🎉 Thanks so much for testing this approach thoroughly in the app! (I finally set up cellxgene with Matt's help this morning lol) I'll share the solution back on Stackoverflow now too! |
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.
Looks super good! Just a few nits. Otherwise LGTM! Thanks again for taking on this, @seve 🎉 👍 🥇
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.
several nits/cleanup items, but OK overall. Thanks!
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.
ps. please don't merge until all tests pass.
Across the app, we practice truncating large strings by taking a slice of some size out of the middle of the string and replacing it with ellipses. The number of truncations needed throughout the app has begun to grow and the work associated with keeping the methodology between instances has been growing with it.
This PR introduces a Truncation component in the new dir:
client/src/components/util/
. Given a single child holding text and a width style, the component calculates whether the text needs truncation and truncates to the largest fitting size.h/t @tihuan for providing a CSS solution and steering me along the way 🎉
This PR implements the following changes:
client/src/components/util/truncate.js
client/src/components/categorical/category/index.js
+client/src/components/categorical/value/index.js
+client/src/components/leftSidebar/topLeftLogoAndTitle.js
Truncate
componentclient/src/components/graph/overlays/centroidLabels.js
+client/src/components/categorical/value/occupancy.js
fontFamily
style declarationsclient/configuration/eslint/eslint.js
client/configuration/lint-staged/lint-staged.config.js
Closes #1489