Skip to content

Commit 0bd2f82

Browse files
authored
feat(global-header): use new theme package (#759)
1 parent 54ba097 commit 0bd2f82

9 files changed

Lines changed: 50 additions & 25 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-global-header': minor
3+
---
4+
5+
**Breaking change**: Use new theme package. Global header items will now use the `theme.rhdh?.general.appBarForegroundColor` colour if defined, and fall back to `theme.palette.text.primary`. This may cause your global header to not look correct in light mode when using the legacy theme.

workspaces/global-header/packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@mui/icons-material": "5.16.14",
5151
"@red-hat-developer-hub/backstage-plugin-global-header": "workspace:^",
5252
"@red-hat-developer-hub/backstage-plugin-global-header-test": "workspace:^",
53-
"@redhat-developer/red-hat-developer-hub-theme": "^0.5.0",
53+
"@red-hat-developer-hub/backstage-plugin-theme": "^0.8.1",
5454
"react": "^18.0.2",
5555
"react-dom": "^18.0.2",
5656
"react-router": "^6.3.0",

workspaces/global-header/packages/app/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import { SignalsDisplay } from '@backstage/plugin-signals';
5656
import { NotificationsPage } from '@backstage/plugin-notifications';
5757
import { githubAuthApiRef } from '@backstage/core-plugin-api';
5858

59-
import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme';
59+
import { getAllThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
6060

6161
const app = createApp({
6262
apis,

workspaces/global-header/plugins/global-header/dev/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import Button from '@mui/material/Button';
3636
import { ScalprumContext, ScalprumState } from '@scalprum/react-core';
3737
import { PluginStore } from '@openshift/dynamic-plugin-sdk';
3838

39-
import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme';
39+
import { getAllThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
4040

4141
import {
4242
GlobalHeader,

workspaces/global-header/plugins/global-header/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@backstage/plugin-search-common": "^1.2.17",
6868
"@backstage/test-utils": "^1.7.5",
6969
"@openshift/dynamic-plugin-sdk": "^5.0.1",
70-
"@redhat-developer/red-hat-developer-hub-theme": "^0.5.0",
70+
"@red-hat-developer-hub/backstage-plugin-theme": "^0.8.1",
7171
"@testing-library/jest-dom": "^6.0.0",
7272
"@testing-library/react": "^14.0.0",
7373
"@testing-library/user-event": "^14.0.0",

workspaces/global-header/plugins/global-header/src/components/GlobalHeaderComponent.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ export const GlobalHeaderComponent = ({
4848

4949
return (
5050
<AppBar position="sticky" component="nav" id="global-header">
51-
<Toolbar sx={{ gap: 1 }}>
51+
<Toolbar
52+
sx={{
53+
gap: 1,
54+
color: theme =>
55+
(theme as any).rhdh?.general.appBarForegroundColor ??
56+
theme.palette.text.primary,
57+
}}
58+
>
5259
{mountPoints.map((mountPoint, index) => (
5360
<ErrorBoundary key={`header-component-${index}`}>
5461
<mountPoint.Component

workspaces/global-header/plugins/global-header/src/components/HeaderDropdownComponent/CreateDropdown.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ export const CreateDropdown = ({ layout }: CreateDropdownProps) => {
7070
buttonProps={{
7171
variant: 'outlined',
7272
sx: {
73-
color: '#fff',
74-
border: '1px solid rgba(255, 255, 255, 0.5)',
75-
'&:hover, &.Mui-focusVisible': {
76-
border: '1px solid #fff',
77-
},
73+
color: 'inherit',
7874
...layout,
7975
},
8076
}}

workspaces/global-header/plugins/global-header/src/components/SearchComponent/SearchInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export const SearchInput = ({
4141
disableUnderline: true,
4242
startAdornment: (
4343
<InputAdornment position="start">
44-
<SearchIcon style={{ color: '#fff' }} />
44+
<SearchIcon style={{ color: 'inherit' }} />
4545
</InputAdornment>
4646
),
4747
}}
4848
sx={{
49-
input: { color: '#fff' },
50-
button: { color: '#fff' },
49+
input: { color: 'inherit' },
50+
button: { color: 'inherit' },
5151
'& fieldset': { border: 'none' },
5252
}}
5353
/>

workspaces/global-header/yarn.lock

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9601,6 +9601,22 @@ __metadata:
96019601
languageName: node
96029602
linkType: hard
96039603

9604+
"@mui/icons-material@npm:^5.17.1":
9605+
version: 5.17.1
9606+
resolution: "@mui/icons-material@npm:5.17.1"
9607+
dependencies:
9608+
"@babel/runtime": ^7.23.9
9609+
peerDependencies:
9610+
"@mui/material": ^5.0.0
9611+
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
9612+
react: ^17.0.0 || ^18.0.0 || ^19.0.0
9613+
peerDependenciesMeta:
9614+
"@types/react":
9615+
optional: true
9616+
checksum: 015149e65add85ab0c669829fabf2cfb9c0a95e33a527716f05f8bdc48247a1f0db5e4c83406d70e22600f7c8e54c339a7237e5d8223b73caa724d7b87ce2b0a
9617+
languageName: node
9618+
linkType: hard
9619+
96049620
"@mui/material@npm:5.16.14, @mui/material@npm:^5.12.2":
96059621
version: 5.16.14
96069622
resolution: "@mui/material@npm:5.16.14"
@@ -11389,7 +11405,7 @@ __metadata:
1138911405
"@mui/material": 5.16.14
1139011406
"@mui/styled-engine": 5.16.14
1139111407
"@openshift/dynamic-plugin-sdk": ^5.0.1
11392-
"@redhat-developer/red-hat-developer-hub-theme": ^0.5.0
11408+
"@red-hat-developer-hub/backstage-plugin-theme": ^0.8.1
1139311409
"@scalprum/react-core": 0.9.3
1139411410
"@testing-library/jest-dom": ^6.0.0
1139511411
"@testing-library/react": ^14.0.0
@@ -11404,18 +11420,19 @@ __metadata:
1140411420
languageName: unknown
1140511421
linkType: soft
1140611422

11407-
"@redhat-developer/red-hat-developer-hub-theme@npm:^0.5.0":
11408-
version: 0.5.0
11409-
resolution: "@redhat-developer/red-hat-developer-hub-theme@npm:0.5.0"
11423+
"@red-hat-developer-hub/backstage-plugin-theme@npm:^0.8.1":
11424+
version: 0.8.1
11425+
resolution: "@red-hat-developer-hub/backstage-plugin-theme@npm:0.8.1"
11426+
dependencies:
11427+
"@mui/icons-material": ^5.17.1
1141011428
peerDependencies:
11411-
"@backstage/theme": ^0.5.2
11412-
"@emotion/react": ^11.11.1
11413-
"@emotion/styled": ^11.11.0
11414-
"@material-ui/core": ^4.12.4
11429+
"@backstage/core-plugin-api": ^1.10.4
11430+
"@backstage/theme": ^0.6.4
1141511431
"@material-ui/icons": ^4.11.3
11416-
"@mui/icons-material": ^5.14.19
11417-
"@mui/material": ^5.14.20
11418-
checksum: 158667ac33e7b926fec2c7ed9d26c3bd81deafe8b0026316ab171e66dd2f3a36474225e42b7ac8527d0e357c1c11432fe767f0cd46b2cd86464e53e4c146a09c
11432+
"@mui/icons-material": ^5.17.1
11433+
"@mui/material": ^5.0.0
11434+
react: ^16.13.1 || ^17.0.0 || ^18.0.0
11435+
checksum: 0d492e2bc4deb69525687219fd30965bffff84a8a9521323c5b0000302957c1c9f58aa1096ca760a71de282fc36aba1029a8fdd1ce6d1eae33db74e199631a9f
1141911436
languageName: node
1142011437
linkType: hard
1142111438

@@ -16354,7 +16371,7 @@ __metadata:
1635416371
"@playwright/test": 1.50.1
1635516372
"@red-hat-developer-hub/backstage-plugin-global-header": "workspace:^"
1635616373
"@red-hat-developer-hub/backstage-plugin-global-header-test": "workspace:^"
16357-
"@redhat-developer/red-hat-developer-hub-theme": ^0.5.0
16374+
"@red-hat-developer-hub/backstage-plugin-theme": ^0.8.1
1635816375
"@testing-library/dom": ^9.0.0
1635916376
"@testing-library/jest-dom": ^6.0.0
1636016377
"@testing-library/react": ^14.0.0

0 commit comments

Comments
 (0)