guan404ming commented on code in PR #54305:
URL: https://github.com/apache/airflow/pull/54305#discussion_r2265105689


##########
airflow-core/src/airflow/ui/src/layouts/Nav/PluginMenuItem.tsx:
##########
@@ -23,19 +23,31 @@ import { RiArchiveStackLine } from "react-icons/ri";
 import { Link as RouterLink } from "react-router-dom";
 
 import type { ExternalViewResponse } from "openapi/requests/types.gen";
+import { useColorMode } from "src/context/colorMode";
 import type { NavItemResponse } from "src/utils/types";
 
 import { NavButton } from "./NavButton";
 
 type Props = { readonly topLevel?: boolean } & NavItemResponse;
 
-export const PluginMenuItem = ({ icon, name, topLevel = false, url_route: 
urlRoute, ...rest }: Props) => {
+export const PluginMenuItem = ({
+  icon,
+  // eslint-disable-next-line @typescript-eslint/naming-convention
+  icon_dark_mode,
+  name,
+  topLevel = false,
+  url_route: urlRoute,
+  ...rest
+}: Props) => {
   // Determine if this is an external view or react app based on the presence 
of href
+  const { colorMode } = useColorMode();
   const isExternalView = "href" in rest;
   const href = isExternalView ? (rest as ExternalViewResponse).href : 
undefined;
 
   const pluginIcon =
-    typeof icon === "string" ? (
+    colorMode === "dark" && typeof icon_dark_mode === "string" ? (
+      <Image height="1.25rem" mr={topLevel ? 0 : 2} src={icon_dark_mode} 
width="1.25rem" />

Review Comment:
   We could make two icon use the same component which makes it easier to 
maintain in the future!
   
   ```js
   <Image height="1.25rem" mr={topLevel ? 0 : 2} src={colorMode === "dark" && 
typeof icon_dark_mode === "string" ? icon_dark_mode : icon} width="1.25rem" />
   ```
   
   or 
   
   ```js
   const isDarkMode = colorMode === "dark" && typeof icon_dark_mode === "string"
   
   <Image height="1.25rem" mr={topLevel ? 0 : 2} src={isDarkMode ? 
icon_dark_mode : icon} width="1.25rem" />
   ```



-- 
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]

Reply via email to