jscheffl commented on code in PR #54305:
URL: https://github.com/apache/airflow/pull/54305#discussion_r2265346316
##########
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:
I attempted another way as first we need to select if the icon is anyway in
place... so forst depending on color mode the icon is picked with standard as
fall back if dark is not defined and then if any icon selected renders the
<Image (once).
--
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]