Skip to content

Commit df2776b

Browse files
fix(deps): update rhdh global ui dependencies (minor) (#953)
* fix(deps): update rhdh global ui dependencies (minor) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix regressions with new theme --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: logonoff <git@logonoff.co>
1 parent 6495f17 commit df2776b

12 files changed

Lines changed: 139 additions & 92 deletions

File tree

workspaces/global-floating-action-button/packages/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
"@mui/material": "5.17.1",
4747
"@mui/styles": "5.17.1",
4848
"@red-hat-developer-hub/backstage-plugin-global-floating-action-button": "workspace:^",
49-
"@red-hat-developer-hub/backstage-plugin-theme": "^0.8.0",
49+
"@red-hat-developer-hub/backstage-plugin-theme": "^0.9.0",
5050
"react": "^18.0.2",
5151
"react-dom": "^18.0.2",
5252
"react-router-dom": "^6.3.0"
5353
},
5454
"devDependencies": {
55-
"@playwright/test": "1.52.0",
55+
"@playwright/test": "1.53.0",
5656
"@testing-library/jest-dom": "^6.0.0",
5757
"@testing-library/react": "^14.0.0",
5858
"@types/react-dom": "*"

workspaces/global-floating-action-button/yarn.lock

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9282,14 +9282,14 @@ __metadata:
92829282
languageName: node
92839283
linkType: hard
92849284

9285-
"@playwright/test@npm:1.52.0":
9286-
version: 1.52.0
9287-
resolution: "@playwright/test@npm:1.52.0"
9285+
"@playwright/test@npm:1.53.0":
9286+
version: 1.53.0
9287+
resolution: "@playwright/test@npm:1.53.0"
92889288
dependencies:
9289-
playwright: 1.52.0
9289+
playwright: 1.53.0
92909290
bin:
92919291
playwright: cli.js
9292-
checksum: a7e30109399ad40b9c5a5322d8adbb4f759e139169deb8c0c9b62ec678359bb0bb64155497f05dc4a96ff582da55c4f821da6f59d4b321b154ae706c923ee3b5
9292+
checksum: 63c8264134b9ceb1a9e40af9a2e262f11f74c791c739ade6d39177de42a28016d3a9c807ce893048b2c3247a633b5e8c7805e013c6f87c85b1360a83363d74ba
92939293
languageName: node
92949294
linkType: hard
92959295

@@ -10030,19 +10030,19 @@ __metadata:
1003010030
languageName: unknown
1003110031
linkType: soft
1003210032

10033-
"@red-hat-developer-hub/backstage-plugin-theme@npm:^0.8.0":
10034-
version: 0.8.2
10035-
resolution: "@red-hat-developer-hub/backstage-plugin-theme@npm:0.8.2"
10033+
"@red-hat-developer-hub/backstage-plugin-theme@npm:^0.9.0":
10034+
version: 0.9.0
10035+
resolution: "@red-hat-developer-hub/backstage-plugin-theme@npm:0.9.0"
1003610036
dependencies:
1003710037
"@mui/icons-material": ^5.17.1
1003810038
peerDependencies:
10039-
"@backstage/core-plugin-api": ^1.10.4
10040-
"@backstage/theme": ^0.6.4
10039+
"@backstage/core-plugin-api": ^1.10.7
10040+
"@backstage/theme": ^0.6.6
1004110041
"@material-ui/icons": ^4.11.3
1004210042
"@mui/icons-material": ^5.17.1
1004310043
"@mui/material": ^5.0.0
1004410044
react: ^16.13.1 || ^17.0.0 || ^18.0.0
10045-
checksum: 76488ae3fbb9fabdd936d7a1353fda0b1d11fa9439cb33333678eccfcd71fdd1c9cf60418828d94ee26f3b1874a873767996eebbedb01b3fbf57200dee5c562d
10045+
checksum: 365e81ba8af0fe38587e21bd842ede6eb6ee2d1590dbad26c3e5e6ca42c885b4e19de3cfc9435f43113f67960cf57c4614011596d4332def1bac93b9a6199860
1004610046
languageName: node
1004710047
linkType: hard
1004810048

@@ -14393,9 +14393,9 @@ __metadata:
1439314393
"@mui/icons-material": 5.17.1
1439414394
"@mui/material": 5.17.1
1439514395
"@mui/styles": 5.17.1
14396-
"@playwright/test": 1.52.0
14396+
"@playwright/test": 1.53.0
1439714397
"@red-hat-developer-hub/backstage-plugin-global-floating-action-button": "workspace:^"
14398-
"@red-hat-developer-hub/backstage-plugin-theme": ^0.8.0
14398+
"@red-hat-developer-hub/backstage-plugin-theme": ^0.9.0
1439914399
"@testing-library/jest-dom": ^6.0.0
1440014400
"@testing-library/react": ^14.0.0
1440114401
"@types/react-dom": "*"
@@ -27660,27 +27660,27 @@ __metadata:
2766027660
languageName: node
2766127661
linkType: hard
2766227662

27663-
"playwright-core@npm:1.52.0":
27664-
version: 1.52.0
27665-
resolution: "playwright-core@npm:1.52.0"
27663+
"playwright-core@npm:1.53.0":
27664+
version: 1.53.0
27665+
resolution: "playwright-core@npm:1.53.0"
2766627666
bin:
2766727667
playwright-core: cli.js
27668-
checksum: 28aa7785afb6ef9b05e8573a0655cb7cf72a782329f51d1e152ed94273c69206588b44a9440ca4b500cd1a15e6068ec9c2746ec4666a89bcce2854d429d22dc8
27668+
checksum: 00d6c8f566608681e1ab529ecb86a4e8c818f77605438e38e1b7ebf04b41b4df115217fe89cfe535d0a0a9f08807ab0b66d4f9da61c5609060cc68859c7c4354
2766927669
languageName: node
2767027670
linkType: hard
2767127671

27672-
"playwright@npm:1.52.0":
27673-
version: 1.52.0
27674-
resolution: "playwright@npm:1.52.0"
27672+
"playwright@npm:1.53.0":
27673+
version: 1.53.0
27674+
resolution: "playwright@npm:1.53.0"
2767527675
dependencies:
2767627676
fsevents: 2.3.2
27677-
playwright-core: 1.52.0
27677+
playwright-core: 1.53.0
2767827678
dependenciesMeta:
2767927679
fsevents:
2768027680
optional: true
2768127681
bin:
2768227682
playwright: cli.js
27683-
checksum: ad072d7c2eef2568f9b35471221eeb838406e7d4b9c38624430003c235b0b939fd10d02080e6fa39ece43e88d04be0b6f3d875d16aa82ae691705f5ac2055ec5
27683+
checksum: a8e69cecac82515e018f68aeccdae0bd8d4e18e3741330e79129c1705780fef6591294c0fe0f71f1ab4242a00032c3896eae9ceb40c5e03d53265f993de8cd42
2768427684
languageName: node
2768527685
linkType: hard
2768627686

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': patch
3+
---
4+
5+
Updated dependency `@red-hat-developer-hub/backstage-plugin-theme` to `^0.9.0`.

workspaces/global-header/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"@backstage/e2e-test-utils": "^0.1.1",
4444
"@backstage/repo-tools": "^0.13.4",
4545
"@changesets/cli": "^2.27.1",
46-
"@playwright/test": "1.52.0",
46+
"@playwright/test": "1.53.0",
4747
"@spotify/prettier-config": "^12.0.0",
4848
"knip": "^5.27.4",
4949
"node-gyp": "^9.0.0",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
"@mui/material": "5.17.1",
5252
"@red-hat-developer-hub/backstage-plugin-global-header": "workspace:^",
5353
"@red-hat-developer-hub/backstage-plugin-global-header-test": "workspace:^",
54-
"@red-hat-developer-hub/backstage-plugin-theme": "^0.8.2",
54+
"@red-hat-developer-hub/backstage-plugin-theme": "^0.9.0",
5555
"react": "^18.0.2",
5656
"react-dom": "^18.0.2",
5757
"react-router": "^6.3.0",
5858
"react-router-dom": "^6.3.0"
5959
},
6060
"devDependencies": {
6161
"@backstage/test-utils": "^1.7.8",
62-
"@playwright/test": "1.52.0",
62+
"@playwright/test": "1.53.0",
6363
"@testing-library/dom": "^9.0.0",
6464
"@testing-library/jest-dom": "^6.0.0",
6565
"@testing-library/react": "^14.0.0",

workspaces/global-header/packages/app/src/components/Root/Root.tsx

Lines changed: 75 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616

1717
import { PropsWithChildren } from 'react';
18-
import { makeStyles } from '@material-ui/core';
18+
import { styled } from '@mui/material/styles';
19+
import Box from '@mui/material/Box';
1920
import HomeIcon from '@material-ui/icons/Home';
2021
import ExtensionIcon from '@material-ui/icons/Extension';
2122
import LibraryBooks from '@material-ui/icons/LibraryBooks';
@@ -37,57 +38,94 @@ import {
3738
} from '@red-hat-developer-hub/backstage-plugin-global-header';
3839
import { NotificationsSidebarItem } from '@backstage/plugin-notifications';
3940

40-
const useStyles = makeStyles(() => ({
41-
pageWithoutFixHeight: {
42-
'> div[class*="-sidebarLayout"]': {
43-
height: '100vh',
41+
/** This component is copy pasted from RHDH and should be kept in sync. */
42+
const PageWithoutFixHeight = styled(Box, {
43+
name: 'RHDHPageWithoutFixHeight',
44+
slot: 'root',
45+
})(() => ({
46+
// Use the complete viewport (similar to how Backstage does it) and make the
47+
// page content part scrollable below. We also need to compensate for the
48+
// above-sidebar position of the global header as it takes up a fixed height
49+
// at the top of the page.
50+
display: 'flex',
51+
flexDirection: 'column',
52+
height: '100vh',
53+
54+
// This solves the same issue for techdocs, which was reported as
55+
// https://issues.redhat.com/browse/RHIDP-4637
56+
'.techdocs-reader-page > main': {
57+
height: 'unset',
58+
},
59+
}));
60+
61+
/** This component is copy pasted from RHDH and should be kept in sync. */
62+
const SidebarLayout = styled(Box, {
63+
name: 'RHDHPageWithoutFixHeight',
64+
slot: 'sidebarLayout',
65+
shouldForwardProp: prop =>
66+
prop !== 'aboveSidebarHeaderHeight' &&
67+
prop !== 'aboveMainContentHeaderHeight',
68+
})(
69+
({
70+
aboveSidebarHeaderHeight,
71+
aboveMainContentHeaderHeight,
72+
}: {
73+
aboveSidebarHeaderHeight?: number;
74+
aboveMainContentHeaderHeight?: number;
75+
}) => ({
76+
// We remove Backstage's 100vh on the content, and instead rely on flexbox
77+
// to take up the whole viewport.
78+
display: 'flex',
79+
flexGrow: 1,
80+
maxHeight: `calc(100vh - ${aboveSidebarHeaderHeight ?? 0}px)`,
81+
82+
'& div[class*="BackstageSidebarPage"]': {
4483
display: 'flex',
4584
flexDirection: 'column',
46-
},
47-
'> div > main': {
4885
height: 'unset',
4986
flexGrow: 1,
87+
// Here we override the theme so that the Backstage default page suspense
88+
// takes up the whole height of the page instead of 100vh. The difference
89+
// lies in the height of the global header above the sidebar.
90+
'@media (min-width: 600px)': {
91+
'& > [class*="MuiLinearProgress-root"]': {
92+
height: 'unset',
93+
flexGrow: 1,
94+
},
95+
},
5096
},
51-
'.techdocs-reader-page > main': {
52-
height: 'unset',
97+
98+
// The height is controlled by the flexbox in the BackstageSidebarPage.
99+
'& main[class*="BackstagePage-root"]': {
100+
height: `calc(100vh - ${
101+
aboveSidebarHeaderHeight! + aboveMainContentHeaderHeight!
102+
}px)`,
103+
flexGrow: 1,
53104
},
54-
},
55-
sidebarItem: {
56-
textDecorationLine: 'none',
57-
},
58-
sidebarLayout: {
105+
106+
// We need to compensate for the above-sidebar position of the global header
107+
// as it takes up a fixed height at the top of the page.
59108
'& div[class*="BackstageSidebar-drawer"]': {
60-
top: 'var(--global-header-default-height, 64px)',
61-
height: 'calc(100vh - var(--global-header-default-height, 64px))',
109+
top: `max(0px, ${aboveSidebarHeaderHeight ?? 0}px)`,
62110
},
63-
'& main[class*="BackstagePage-root"]': {
64-
height: `calc(100vh - (var(--global-header-default-height, 64px) - var(--rhdh-v1-page-inset, 1.5rem)))`,
65-
marginTop: 'calc(-1 * var(--rhdh-v1-page-inset, 1.5rem))',
66-
marginBottom: 'calc(-1 * var(--rhdh-v1-page-inset, 1.5rem))',
67-
overflow: 'hidden',
68-
display: 'flex',
69-
flexDirection: 'column',
70-
'& article': {
71-
flex: 1,
72-
overflow: 'auto',
73-
},
74-
},
75-
},
76-
}));
111+
}),
112+
);
77113

78114
export const Root = ({ children = null }: PropsWithChildren<{}>) => {
79-
const { pageWithoutFixHeight, sidebarLayout } = useStyles();
80-
81115
return (
82-
<div className={pageWithoutFixHeight}>
83-
<div>
116+
<PageWithoutFixHeight>
117+
<div id="above-sidebar-header-container">
84118
{/* update globalHeaderMountPoints config to test Global header */}
85119
<GlobalHeaderComponent
86120
globalHeaderMountPoints={defaultGlobalHeaderComponentsMountPoints}
87121
/>
88122
</div>
89-
<div className={sidebarLayout}>
123+
<SidebarLayout
124+
aboveMainContentHeaderHeight={0}
125+
aboveSidebarHeaderHeight={64}
126+
>
90127
<SidebarPage>
128+
<div id="above-main-content-header-container" />
91129
<Sidebar>
92130
<SidebarGroup label="Menu" icon={<MenuIcon />}>
93131
{/* Global nav, not org-specific */}
@@ -115,7 +153,7 @@ export const Root = ({ children = null }: PropsWithChildren<{}>) => {
115153
</Sidebar>
116154
{children}
117155
</SidebarPage>
118-
</div>
119-
</div>
156+
</SidebarLayout>
157+
</PageWithoutFixHeight>
120158
);
121159
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"@backstage/plugin-search-common": "^1.2.18",
6969
"@backstage/test-utils": "^1.7.8",
7070
"@openshift/dynamic-plugin-sdk": "^5.0.1",
71-
"@red-hat-developer-hub/backstage-plugin-theme": "^0.8.1",
71+
"@red-hat-developer-hub/backstage-plugin-theme": "^0.9.0",
7272
"@testing-library/jest-dom": "^6.0.0",
7373
"@testing-library/react": "^14.0.0",
7474
"@testing-library/user-event": "^14.0.0",

workspaces/global-header/plugins/global-header/src/components/CompanyLogo/DefaultLogo.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { useTheme } from '@mui/material/styles';
18+
import type { ThemeConfig } from '@red-hat-developer-hub/backstage-plugin-theme';
1819

1920
const LightThemeLogoSVG = () => (
2021
<svg
@@ -269,7 +270,9 @@ const DarkThemeLogoSVG = () => (
269270
);
270271
const DefaultLogo = () => {
271272
const theme = useTheme();
272-
const isDarkMode = theme.palette.mode === 'dark';
273+
const isDarkMode =
274+
(theme as ThemeConfig)?.palette?.rhdh?.general?.appBarBackgroundScheme ===
275+
'dark';
273276
return isDarkMode ? <DarkThemeLogoSVG /> : <LightThemeLogoSVG />;
274277
};
275278

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const Divider = ({ layout }: DividerProps) => {
3232
<MUIDivider
3333
orientation="vertical"
3434
flexItem
35-
sx={{ borderColor: '#383838', marginX: 1, ...layout }}
35+
sx={{ borderColor: 'inherit', opacity: 0.25, marginX: 1, ...layout }}
3636
/>
3737
);
3838
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const SearchBar = (props: SearchBarProps) => {
7979
componentsProps={{
8080
paper: {
8181
sx: {
82+
'&:empty': { visibility: 'hidden' }, // Removes underline-like effect
8283
borderRadius: '4px',
8384
outline: 'unset',
8485
boxShadow:

0 commit comments

Comments
 (0)