-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: Update native filter dividers to support horizontal display #21970
Conversation
a91b9e2
to
c5a0b56
Compare
Codecov Report
@@ Coverage Diff @@
## master #21970 +/- ##
==========================================
+ Coverage 65.72% 65.74% +0.01%
==========================================
Files 1809 1811 +2
Lines 69335 69370 +35
Branches 7413 7425 +12
==========================================
+ Hits 45571 45606 +35
Misses 21853 21853
Partials 1911 1911
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
title: string; | ||
description: string; | ||
horizontal?: boolean; | ||
horizontalOverflow?: boolean; |
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.
@codyml I'm curious whether the verticalOverflow
might be in the future. If it is, should we use props like overflow
to control this?
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.
Sounds good, changed horizontalOverflow
to overflow
in case we want to support that in the future. Since the styles are unique, another option is that I could have an orientation
field that accepts constants for each supported orientation (vertical, horizontal, horizontal overflow) and we could add a 4th constant if we end up wanting to support vertical overflow dropdown – let me know if that sounds better.
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.
Thanks for the awesome work! Just a few nits from a first look
horizontalOverflow?: boolean; | ||
} | ||
|
||
const useIsTruncated = <T extends HTMLElement>( |
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.
I saw this hook being used in at least 3 more places in the app. We should move this to the common hooks if possible. In a separate PR we can then go back and replace it everywhere else
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 like there's an useTruncation
hook already in src/hooks
, but it's for the separate use-case of multiple child elements with element truncation controlled by JS, rather than one element with text truncation controlled by CSS. I kept the default export of useTruncation
the element version and added a new export of useCSSTextTruncation
– does that seem like a good solution?
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
font-size: 14px; |
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.
We should use the provided typography settings in the theme
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.
Done!
data-test="divider-description-icon" | ||
css={(theme: SupersetTheme) => css` | ||
color: ${theme.colors.grayscale.base}; | ||
font-size: 16px; |
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.
Icons have a property iconSize
with predefined sizes. We should stick to those whenever possible.
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.
Done! Also moved color to iconColor
.
text-overflow: ellipsis; | ||
color: ${theme.colors.grayscale.dark1}; | ||
font-weight: normal; | ||
font-size: 14px; |
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.
Same comment about font-size as above
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
font-size: 12px; |
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.
This too
5fadb30
to
3d175ff
Compare
Closing in favor of #22169. |
SUMMARY
This PR updates native filter dividers to display correctly when native filters are rendered as a horizontal bar, which will be supported in a future PR. In this PR, the divider is factored out into its own component,
FilterDivider
, which now supports three view modes:BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Vertical (same as before):
Horizontal:
Horizontal overflow:
TESTING INSTRUCTIONS
FilterDivider
component, which should contain Vertical Filter Divider, Horizontal Filter Divider, and Horizontal Overflow Filter Divider. Check that all three behave as expected with:ADDITIONAL INFORMATION