-
Notifications
You must be signed in to change notification settings - Fork 14.9k
refactor(Collapse): Upgrade Collapse to Antd5 #32959
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
refactor(Collapse): Upgrade Collapse to Antd5 #32959
Conversation
Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment
|
aria-label="Copy" | ||
tooltip={t('Copy SELECT statement to the clipboard')} | ||
className={ | ||
`fa fa-sort-${sortColumns ? 'numeric' : 'alpha'}-asc ` + |
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 are removing usages of fa icons from the codebase. Can you use the Icons component from src/components/Icons
instead?
<CopyToClipboard | ||
copyNode={ | ||
<IconTooltip | ||
aria-label="Copy" |
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.
Let's localize this too. I see inconsistent localization with this prop across the codebase but I guess localizing won't hurt.
expandIconPosition === 'right' && | ||
` | ||
.anticon.anticon-right.ant-collapse-arrow > svg { | ||
${({ expandIconPosition }) => |
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 is all necessary because Ant Design does not support arrows on the right?
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.
It does, but the arrow points to the right by default. In Superset, when the arrow is on the right, it points down when closed and up when open
</Collapse> | ||
items={[ | ||
{ | ||
key: '1', |
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.
Can we use human-readable keys?
<Collapse | ||
items={[ | ||
{ | ||
key: '1', |
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.
human-readable if possible
{!queryData ? ( | ||
items={[ | ||
{ | ||
key: '1', |
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 human-readable
2eb2f43
to
a331275
Compare
{tables.map(table => ( | ||
<TableElement | ||
table={table} | ||
key={table.id} | ||
activeKey={tables | ||
.filter(({ expanded }) => expanded) | ||
.map(({ id }) => id)} | ||
onChange={onToggleTable} | ||
/> | ||
))} |
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 am not sure why this refactor of Collapse into TableElement necessary?
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.
Mainly because of the hover functionality for the tooltip and the fact that the Collapse items prop accepts label and children as separate components
> | ||
<Icons.SyncOutlined | ||
iconSize="m" | ||
iconColor={theme.colors.grayscale.dark5} |
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 think we are trying to use Ant Design tokens whenever we can so i am not sure but this would roughly map to theme.colorIcon
?
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.
aria-hidden | ||
iconColor={ | ||
sortColumns | ||
? theme.colors.grayscale.dark5 |
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 here
<Icons.CopyOutlined | ||
iconSize="m" | ||
aria-hidden | ||
iconColor={theme.colors.grayscale.dark5} |
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.
and here
<Icons.CloseOutlined | ||
iconSize="m" | ||
aria-hidden | ||
iconColor={theme.colors.grayscale.dark5} |
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.
and here
@@ -41,9 +41,11 @@ const collapseStyle = (theme: SupersetTheme) => css` | |||
.ant-collapse-arrow { | |||
left: 0px !important; | |||
} | |||
|
|||
.ant-collapse-header { |
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.
Won't these classnames change to antd5?
{ | ||
key: `${filterId}-${FilterPanels.configuration.key}`, | ||
label: FilterPanels.configuration.name, | ||
children: ( |
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.
Is losing forceRender not important here?
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.
Restored the forceRender
@@ -105,7 +105,7 @@ const ColumnElement = ({ column }: ColumnElementProps) => { | |||
} | |||
return ( | |||
<div className="clearfix table-column"> | |||
<div className="pull-left m-l-10 col-name"> | |||
<div className="pull-left col-name"> |
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.
Do we know where these classes are coming from? Can we use the standard Ant Design approach here, like Flex
or Space
?
} | ||
} | ||
`} | ||
const StyledControls = styled.div` |
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.
Don't want to go too much outside of the scope of the PR but do you think we can use standard Ant Design Flex
and Space
components to manage the layout for all the styles in this file?
width: 100%; | ||
height: 1px; | ||
display: block; | ||
background: ${theme.colors.grayscale.light3}; |
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.
Do we need this? Can we use an Ant Design color instead? Also, this should be a standard atomic component?
@DamianPendrak I see some pre-commit checks fail, highly recommend setting up pre-commit -> https://superset.apache.org/docs/contributing/development/#git-hooks Once you do, you may want to squish your commits as a way to re-trigger it on all the files you touched in this PR. |
Also wondering what's required to do in order for going from a DRAFT PR to "ready for review" |
I think I will fix the failing tests and then mark it ready |
0d03d4d
to
bb7a638
Compare
You have a conflict. Thanks for the hard work on 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.
Approving as it looks mostly good with comments I have left above. It would be great to have more eyes on testing as well. @msyavuz maybe you can help with that.
Thank you!
bb7a638
to
b6013f8
Compare
NICE! Looking forward to merge this one - the theming branch ( |
Fixed except for the Checkbox text color. This is the default Checkbox from Ant Design without custom styles. |
I just fixed the merge conflict in hope to merge this today. NOTE: alphabetizing Icons names would help reduce the odds of conflicts. Looks like it's mostly alphabetized now, but putting the latest icon at the bottom of the list will lead to more merge-conflicts than squeezing it in the list where it belongs. |
Looks like there's a single unit test failing here ^^^ |
Can we re-trigger the tests? They are passing locally and I believe the failing test is not related to the Collapse component. This happened before with this unit test and re-run fixed it |
triggered 🤞 🤞 |
Not sure if we want to preserve previous styling in modals (full width, no rounded corners, ...) or go vanilla. Thought the custom styles in modal was slick, but if we decide to maintain it the styling should be implemented as |
DatabaseModal fix: #33038 |
SUMMARY
Fixes #32542
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Home
Before
After
SQL Editor Table Element
Before
After
Explore Data
Before
After
Connect a database - Advanced tab
Before
After
Upload modal
Before
After
Add Alert / Report
Before
After
Fixed or metric
Before
After
Dashboard filters
Before
After
Dashboard Cross-filters
Before
After
Dasbhoard - Out of scope filters
Before
After
VizTypeGallery
Before
After
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION