-
Notifications
You must be signed in to change notification settings - Fork 15.3k
style(Button): Vertically align icons across all buttons and remove box shadow #34067
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
base: master
Are you sure you want to change the base?
Conversation
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.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Unsafe Children Property Access ▹ view | 🧠 Incorrect |
Files scanned
File Path | Reviewed |
---|---|
superset-frontend/src/components/MessageToasts/Toast.tsx | ✅ |
superset-frontend/packages/superset-ui-core/src/components/Button/index.tsx | ✅ |
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx | ✅ |
superset-frontend/src/pages/DashboardList/index.tsx | ✅ |
superset-frontend/src/pages/ChartList/index.tsx | ✅ |
superset-frontend/src/pages/DatasetList/index.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
if ( | ||
element && | ||
(element.type === Fragment || | ||
element.type === 'span' || | ||
element?.props?.css !== undefined) | ||
) { | ||
renderedChildren = Children.toArray(element.props.children); | ||
} else { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Mmmh, does antd gets this wrong, or is it because we're not using antd right? I noticed antd's button expects an If it's the case I'd much rather fix our use of From my understanding, if/when using button with the icon prop, antd should do all the right things in terms of alignement with standard sizing and all. Guessing it may pass-in/override the icon sizing based on the button's size attributes, also probably should get the color of the icon to match the text and all. I've seen places where we |
@@ -774,10 +774,17 @@ function ChartList(props: ChartListProps) { | |||
if (canCreate) { | |||
subMenuButtons.push({ | |||
name: ( | |||
<> | |||
<span |
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.
Here it seems that we could either change the SubMenu
components to receive actual buttons directly (instead of data structures that get turned into buttons (not sure why someone created this indirection?)), or you could extend it to expect receiving a icon
key in as part of the object.
Seems passing in an array of buttons is more reasonable, but looks like SubMenu is used in many places:
12:06 $ git grep "<SubMenu"
superset-frontend/packages/superset-ui-core/src/ui-overrides/types.ts: 'home.submenu': ComponentType<SubMenuProps>;
superset-frontend/src/features/home/ActivityTable.tsx: <SubMenu
superset-frontend/src/features/home/ChartTable.tsx: <SubMenu
superset-frontend/src/features/home/DashboardTable.tsx: <SubMenu
superset-frontend/src/features/home/LanguagePicker.tsx: <SubMenu
superset-frontend/src/features/home/SavedQueries.tsx: <SubMenu
superset-frontend/src/features/home/SubMenu.test.tsx: <SubMenu {...props} />
superset-frontend/src/features/home/SubMenu.tsx:const SubMenuComponent: FunctionComponent<SubMenuProps> = props => {
superset-frontend/src/features/home/SubMenu.tsx: <SubMenu
superset-frontend/src/pages/ActionLog/index.tsx: <SubMenu name={t('Action Logs')} buttons={subMenuButtons} />
superset-frontend/src/pages/AlertReportList/index.tsx: <SubMenu
superset-frontend/src/pages/AnnotationLayerList/index.tsx: <SubMenu name={t('Annotation layers')} buttons={subMenuButtons} />
superset-frontend/src/pages/AnnotationList/index.tsx: <SubMenu
superset-frontend/src/pages/ChartList/index.tsx: <SubMenu name={t('Charts')} buttons={subMenuButtons} />
superset-frontend/src/pages/CssTemplateList/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/DashboardList/index.tsx: <SubMenu name={t('Dashboards')} buttons={subMenuButtons} />
superset-frontend/src/pages/DatabaseList/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/DatasetList/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/ExecutionLogList/index.tsx: <SubMenu
superset-frontend/src/pages/GroupsList/index.tsx: <SubMenu name={t('List Groups')} buttons={subMenuButtons} />
superset-frontend/src/pages/Home/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/QueryHistoryList/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/RolesList/index.tsx: <SubMenu name={t('List Roles')} buttons={subMenuButtons} />
superset-frontend/src/pages/RowLevelSecurityList/index.tsx: <SubMenu name={t('Row Level Security')} buttons={subMenuButtons} />
superset-frontend/src/pages/SavedQueryList/index.tsx: <SubMenu {...menuData} />
superset-frontend/src/pages/Tags/index.tsx: <SubMenu name={t('Tags')} buttons={subMenuButtons} />
superset-frontend/src/pages/UserInfo/index.tsx: <SubMenu buttons={SubMenuButtons} />
superset-frontend/src/pages/UserRegistrations/index.tsx: <SubMenu name={t('User registrations')} />
superset-frontend/src/pages/UsersList/index.tsx: <SubMenu name={t('List Users')} buttons={subMenuButtons} />
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.
Personally I'm in favor of refactoring/fixing over adding yet another layer on top.
about box-shadow, I'd vote for keeping Superset vanilla antd, and if we decide to change the default style of buttons to not have box-shadow, I'd do it in the default's theme definition, no in the component. By unsetting |
SUMMARY
This PR improves the visual consistency of buttons across the UI by vertically aligning icons within buttons and removing the default box shadow.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before

After

Before

After

Before

After

Before

After

TESTING INSTRUCTIONS
ADDITIONAL INFORMATION