msyavuz commented on code in PR #32112:
URL: https://github.com/apache/superset/pull/32112#discussion_r1971429775


##########
superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx:
##########
@@ -41,7 +41,8 @@ const SaveDatasetActionButton = ({
       onClick={() => setShowSave(true)}
       dropdownRender={() => overlayMenu}
       icon={
-        <Icons.CaretDown
+        <Icons.DownOutlined
+          iconSize="m"

Review Comment:
   Same question here



##########
superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx:
##########
@@ -82,7 +81,7 @@ const QueryLimitSelect = ({
         <span className="limitDropdown">
           {convertToNumWithSpaces(queryLimit)}
         </span>
-        <Icons.TriangleDown iconColor={theme.colors.grayscale.base} />
+        <Icons.CaretDownOutlined iconSize="m" />

Review Comment:
   Is medium the right size for this?



##########
superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx:
##########
@@ -99,7 +140,12 @@ const SqlEditorTabHeader: FC<Props> = ({ queryEditor }) => {
               data-test="close-tab-menu-option"
             >
               <IconContainer>
-                <i className="fa fa-close" />
+                <Icons.CloseOutlined
+                  iconSize="l"
+                  css={css`
+                    verticalalign: middle;
+                  `}
+                />

Review Comment:
   This is not in scope of this PR and also a problem in master but these are 
not accessible via keyboard navigation. Just to keep in mind.



##########
superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx:
##########
@@ -117,14 +114,17 @@ const DropIndicator = styled.div`
   border-radius: 2px;
 `;
 
-const CloseIconWithDropIndicator = props => (
-  <>
-    <StyledCancelXIcon />
-    {props.showDropIndicators.right && (
-      <DropIndicator className="drop-indicator-right" pos="right" />
-    )}
-  </>
-);
+const CloseIconWithDropIndicator = props => {
+  const theme = useTheme();

Review Comment:
   Is this necessary?



##########
superset-frontend/src/components/Icons/AntdEnhanced.tsx:
##########
@@ -128,26 +175,45 @@ const AntdIcons = {
   SaveOutlined,
   SearchOutlined,
   SettingOutlined,
+  StarOutlined,
+  StarFilled,
   StopOutlined,
   SyncOutlined,
+  TagOutlined,
   TagsOutlined,
+  TableOutlined,
+  LockOutlined,
+  UploadOutlined,
   UnlockOutlined,
   UpOutlined,
   UserOutlined,
+  VerticalAlignBottomOutlined,
+  VerticalAlignTopOutlined,
   VerticalLeftOutlined,
   VerticalRightOutlined,
+  NumberOutlined,
+  ThunderboltOutlined,
+  FilterOutlined,
+  UnorderedListOutlined,
+  WarningOutlined,
 };
 
 const AntdEnhancedIcons = Object.keys(AntdIcons)
   .filter(k => !k.includes('TwoTone'))
   .map(k => ({
     [k]: (props: IconType) => {
       const whatRole = props?.onClick ? 'button' : 'img';
-      // @ts-ignore TODO(hainenber): fix the type compatiblity between
-      // StyledIcon component prop and AntdIcon values
-      return <StyledIcon component={AntdIcons[k]} role={whatRole} {...props} 
/>;
+      const ariaLabel = props['aria-label'] || k;
+      return (
+        <StyledIcon
+          // @ts-ignore
+          component={AntdIcons[k as keyof typeof AntdIcons]}

Review Comment:
   If we are ignoring the type anyways can we use AntdIcons[k] instead?



##########
superset-frontend/src/components/DropdownSelectableIcon/index.tsx:
##########
@@ -0,0 +1,177 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { addAlpha, styled, useTheme } from '@superset-ui/core';
+import { FC, RefObject, useMemo, ReactNode, useState } from 'react';
+import Icons from 'src/components/Icons';
+import { DropdownButton } from 'src/components/DropdownButton';
+import { DropdownButtonProps } from 'antd/lib/dropdown';
+import { Menu, MenuProps } from 'src/components/Menu';
+
+const { SubMenu } = Menu;
+
+type SubMenuItemProps = { key: string; label: string | ReactNode };
+
+export interface DropDownSelectableProps extends Pick<MenuProps, 'onSelect'> {
+  ref?: RefObject<HTMLDivElement>;
+  icon: ReactNode;
+  info?: string;
+  menuItems: {
+    key: string;
+    label: string | ReactNode;
+    children?: SubMenuItemProps[];
+    divider?: boolean;
+  }[];
+  selectedKeys?: string[];
+}
+
+const StyledDropdownButton = styled(DropdownButton as FC<DropdownButtonProps>)`
+  button.ant-btn:first-of-type {
+    display: none;
+  }
+  > button.ant-btn:nth-of-type(2) {
+    display: inline-flex;
+    background-color: transparent !important;
+    height: unset;
+    padding: 0;
+    border: none;
+    width: auto !important;
+
+    .anticon {
+      line-height: 0;
+    }
+    &:after {
+      box-shadow: none !important;
+    }
+  }
+`;
+
+const StyledMenu = styled(Menu)`
+  ${({ theme }) => `
+    box-shadow:
+        0 3px 6px -4px ${addAlpha(theme.colors.grayscale.dark2, 0.12)},
+        0 6px 16px 0
+      ${addAlpha(theme.colors.grayscale.dark2, 0.08)},
+        0 9px 28px 8px
+      ${addAlpha(theme.colors.grayscale.dark2, 0.05)};
+    .info {
+      font-size: ${theme.typography.sizes.s}px;
+      color: ${theme.colors.grayscale.base};
+      padding: ${theme.gridUnit}px ${theme.gridUnit * 3}px ${
+        theme.gridUnit
+      }px ${theme.gridUnit * 3}px;
+    }
+    .antd5-dropdown-menu-item-selected {
+      color: ${theme.colors.grayscale.dark1};
+      background-color: ${theme.colors.primary.light5};
+    }
+  `}
+`;
+
+const StyleMenuItem = styled(Menu.Item)<{ divider?: boolean }>`
+  display: flex;
+  justify-content: space-between;
+  > span {
+    width: 100%;
+  }
+  border-bottom: ${({ divider, theme }) =>
+    divider ? `1px solid ${theme.colors.grayscale.light3};` : 'none;'};
+`;
+
+const StyleSubmenuItem = styled.div`
+  display: flex;
+  justify-content: space-between;
+  width: 100%;
+  > div {
+    flex-grow: 1;
+  }
+`;
+
+export default (props: DropDownSelectableProps) => {
+  const theme = useTheme();
+  const [visible, setVisible] = useState(false);
+  const { icon, info, menuItems, selectedKeys, onSelect } = props;
+
+  const handleVisibleChange = setVisible;
+
+  const handleMenuSelect: MenuProps['onSelect'] = info => {
+    if (onSelect) {
+      onSelect(info);
+    }
+    setVisible(false);
+  };
+  const menuItem = useMemo(
+    () => (label: string | ReactNode, key: string, divider?: boolean) => (
+      <StyleMenuItem key={key} divider={divider}>
+        <StyleSubmenuItem>
+          {label}
+          {selectedKeys?.includes(key) && (
+            <Icons.CheckOutlined
+              iconColor={theme.colors.primary.base}
+              className="tick-menu-item"
+              iconSize="xl"
+            />
+          )}
+        </StyleSubmenuItem>
+      </StyleMenuItem>
+    ),
+    [selectedKeys, theme.colors.primary.base],
+  );
+
+  const overlayMenu = useMemo(
+    () => (
+      <>
+        {info && (
+          <div className="info" data-test="dropdown-selectable-info">
+            {info}
+          </div>
+        )}
+        <StyledMenu
+          selectedKeys={selectedKeys}
+          onSelect={handleMenuSelect}
+          selectable
+        >
+          {menuItems.map(m =>
+            m.children?.length ? (
+              <SubMenu
+                title={m.label}
+                key={m.key}
+                data-test="dropdown-selectable-icon-submenu"
+              >
+                {m.children.map(s => menuItem(s.label, s.key))}
+              </SubMenu>
+            ) : (
+              menuItem(m.label, m.key, m.divider)
+            ),
+          )}
+        </StyledMenu>
+      </>
+    ),
+    [selectedKeys, onSelect, info, menuItems, menuItem, handleMenuSelect],
+  );
+
+  return (
+    <StyledDropdownButton
+      overlay={overlayMenu}
+      trigger={['click']}
+      icon={icon}
+      visible={visible}
+      onVisibleChange={handleVisibleChange}
+    />
+  );
+};

Review Comment:
   This component was removed in #31972. Do we need this now?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to