From 833dbea4df1435aaa9e9d31b184045c153f5af98 Mon Sep 17 00:00:00 2001 From: Olivier Liechti Date: Wed, 1 Jun 2022 12:43:31 +0200 Subject: [PATCH] Make the color of the Entity Context Menu icon configurable Signed-off-by: Olivier Liechti --- .../EntityContextMenu/EntityContextMenu.tsx | 17 +++++++++++------ .../src/components/EntityContextMenu/index.ts | 18 ++++++++++++++++++ plugins/catalog/src/overridableComponents.ts | 2 ++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 plugins/catalog/src/components/EntityContextMenu/index.ts diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx index 5664186ab1..0059d3118c 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx @@ -32,12 +32,17 @@ import { IconComponent } from '@backstage/core-plugin-api'; import { useEntityPermission } from '@backstage/plugin-catalog-react'; import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common'; -// TODO(freben): It should probably instead be the case that Header sets the theme text color to white inside itself unconditionally instead -const useStyles = makeStyles({ - button: { - color: 'white', - }, -}); +/** @public */ +export type EntityContextMenuClassKey = 'button'; + +const useStyles = makeStyles( + theme => ({ + button: { + color: 'white', + }, + }), + { name: 'PluginCatalogEntityContextMenu' }, +); // NOTE(freben): Intentionally not exported at this point, since it's part of // the unstable extra context menu items concept below diff --git a/plugins/catalog/src/components/EntityContextMenu/index.ts b/plugins/catalog/src/components/EntityContextMenu/index.ts new file mode 100644 index 0000000000..4a2deb20b4 --- /dev/null +++ b/plugins/catalog/src/components/EntityContextMenu/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed 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. + */ + +export { EntityContextMenu } from './EntityContextMenu'; +export type { EntityContextMenuClassKey } from './EntityContextMenu'; diff --git a/plugins/catalog/src/overridableComponents.ts b/plugins/catalog/src/overridableComponents.ts index e76aafbb68..5cd82202d5 100644 --- a/plugins/catalog/src/overridableComponents.ts +++ b/plugins/catalog/src/overridableComponents.ts @@ -18,11 +18,13 @@ import { StyleRules } from '@material-ui/core/styles/withStyles'; import { EntityLinksEmptyStateClassKey } from './components/EntityLinksCard'; import { SystemDiagramCardClassKey } from './components/SystemDiagramCard'; +import { EntityContextMenuClassKey } from './components/EntityContextMenu'; /** @public */ export type PluginCatalogComponentsNameToClassKey = { PluginCatalogEntityLinksEmptyState: EntityLinksEmptyStateClassKey; PluginCatalogSystemDiagramCard: SystemDiagramCardClassKey; + PluginCatalogEntityContextMenu: EntityContextMenuClassKey; }; /** @public */