Skip to content

Commit 6a328e9

Browse files
committed
fix(app): add mui5 workaround to the shell
This change moves the statically applied classname generator code from each individual wrapper to the application shell to ensure that all plugins using MUI5 have consistent class names applied to those components by the theme provider. Signed-off-by: Stan Lewis <[email protected]>
1 parent 5f291b7 commit 6a328e9

File tree

21 files changed

+9
-174
lines changed
  • docs/dynamic-plugins
  • dynamic-plugins/wrappers
    • backstage-community-plugin-acr/src
    • backstage-community-plugin-jfrog-artifactory/src
    • backstage-community-plugin-nexus-repository-manager/src
    • backstage-community-plugin-ocm/src
    • backstage-community-plugin-quay/src
    • backstage-community-plugin-rbac/src
    • backstage-community-plugin-redhat-argocd/src
    • backstage-community-plugin-tekton/src
    • backstage-community-plugin-topology/src
    • backstage-plugin-notifications/src
    • backstage-plugin-signals/src
    • red-hat-developer-hub-backstage-plugin-adoption-insights/src
    • red-hat-developer-hub-backstage-plugin-bulk-import/src
    • red-hat-developer-hub-backstage-plugin-dynamic-home-page/src
    • red-hat-developer-hub-backstage-plugin-global-floating-action-button/src
    • red-hat-developer-hub-backstage-plugin-global-header/src
    • red-hat-developer-hub-backstage-plugin-marketplace/src
    • red-hat-developer-hub-backstage-plugin-quickstart/src
  • packages/app/src

21 files changed

+9
-174
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ site
4242

4343
# Local configuration files
4444
*.local.yaml
45+
dynamic-plugins.yaml
4546

4647
# Sensitive credentials
4748
*-credentials.local.yaml

docs/dynamic-plugins/known-issues.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,6 @@
22

33
## MUI Version 5 releated issues
44

5-
### Styles are missing
6-
7-
When your plugin uses MUI v5 and is loaded as a dynamic plugin, it will miss some of the default CSS declations from MUI and Backstage/RHDH.
8-
9-
**Workaround:**
10-
11-
Add the following source code to your `<plugin>/src/index.ts` before your plugin is exported:
12-
13-
```tsx
14-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
15-
16-
ClassNameGenerator.configure(componentName => {
17-
return componentName.startsWith('v5-')
18-
? componentName
19-
: `v5-${componentName}`;
20-
});
21-
22-
export * from './plugin';
23-
```
24-
25-
**Alternatives:**
26-
27-
* Use Backstage Core Components or Material UI v4 components from `@material-ui/core/*`.
28-
29-
**Related issues:**
30-
31-
* [RHIDP-5170 - Dynamic plugin loaded plugins that uses MUI v5 looks different then static loaded plugins](https://issues.redhat.com/browse/RHIDP-5170)
32-
* [RHIDP-5847 - Narrow the accepted versions in the scalprum webpack federated module configuration](https://issues.redhat.com/browse/RHIDP-5847)
33-
345
### Grid cards/component misses the default spacing from Backstage
356

367
When your plugin is using the Grid component from `@mui/material/Grid` the default spacing from the Backstage/RHDH theme is missing.
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-acr';
10-
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-jfrog-artifactory';
102

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-nexus-repository-manager';
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-ocm';
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-quay';
102

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-rbac';
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-redhat-argocd';
102

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
2-
3-
ClassNameGenerator.configure(componentName => {
4-
return componentName.startsWith('v5-')
5-
? componentName
6-
: `v5-${componentName}`;
7-
});
8-
91
export * from '@backstage-community/plugin-tekton';
102

0 commit comments

Comments
 (0)