File tree Expand file tree Collapse file tree 5 files changed +38
-404
lines changed
airflow-core/src/airflow/ui/src
dev/react-plugin-tools/react_plugin_template Expand file tree Collapse file tree 5 files changed +38
-404
lines changed Original file line number Diff line number Diff line change @@ -399,6 +399,9 @@ export const customConfig = defineConfig({
399399
400400export const system = createSystem ( defaultConfig , customConfig ) ;
401401
402+ // Once the system is created, make it globally available to dynamically imported React plugins.
403+ Reflect . set ( globalThis , "ChakraUISystem" , system ) ;
404+
402405// Utility function to resolve CSS variables to their computed values
403406// See: https://github.com/chakra-ui/panda/discussions/2200
404407export const getComputedCSSVariableValue = ( variable : string ) : string =>
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ For development and testing, use `pnpm dev` which will:
7272- Start a development server on port 5173
7373- Load the component using ` src/dev.tsx ` entry point
7474- Enable hot module replacement
75+ - Chakra Theme provided for local development is the default one, but in production when the plugin is loaded into the Airflow Core UI,
76+ it will inherit the main application theme for a consistent look and feel.
7577
7678### Library Configuration
7779
Original file line number Diff line number Diff line change 1+ /*!
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+
20+ export interface global { }
21+
22+ declare global {
23+ var ChakraUISystem : SystemContext | undefined
24+ }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import { FC } from "react";
2323import { ColorModeProvider } from "src/context/colorMode" ;
2424import { HomePage } from "src/pages/HomePage" ;
2525
26- import { system } from "./theme" ;
26+ import { localSystem } from "./theme" ;
2727
2828export interface PluginComponentProps {
2929 // Add any props your plugin component needs
@@ -33,6 +33,12 @@ export interface PluginComponentProps {
3333 * Main plugin component
3434 */
3535const PluginComponent : FC < PluginComponentProps > = ( props ) => {
36+
37+ // Use the globalChakraUISystem provided by the Airflow Core UI,
38+ // so the plugin has a consistent theming with the host Airflow UI,
39+ // fallback to localSystem for local development.
40+ const system = ( globalThis . ChakraUISystem ) ?? localSystem ;
41+
3642 return (
3743 < ChakraProvider value = { system } >
3844 < ColorModeProvider >
You can’t perform that action at this time.
0 commit comments