@@ -19,19 +19,14 @@ import { makeStyles } from '@material-ui/core';
1919import HomeIcon from '@material-ui/icons/Home' ;
2020import ExtensionIcon from '@material-ui/icons/Extension' ;
2121import LibraryBooks from '@material-ui/icons/LibraryBooks' ;
22- import LogoFull from './LogoFull' ;
23- import LogoIcon from './LogoIcon' ;
2422import {
2523 Sidebar ,
26- sidebarConfig ,
2724 SidebarDivider ,
2825 SidebarGroup ,
2926 SidebarItem ,
3027 SidebarPage ,
3128 SidebarScrollWrapper ,
3229 SidebarSpace ,
33- useSidebarOpenState ,
34- Link ,
3530} from '@backstage/core-components' ;
3631import MenuIcon from '@material-ui/icons/Menu' ;
3732import { MyGroupsSidebarItem } from '@backstage/plugin-org' ;
@@ -42,66 +37,85 @@ import {
4237} from '@red-hat-developer-hub/backstage-plugin-global-header' ;
4338import { NotificationsSidebarItem } from '@backstage/plugin-notifications' ;
4439
45- const useSidebarLogoStyles = makeStyles ( {
46- root : {
47- width : sidebarConfig . drawerWidthClosed ,
48- height : 3 * sidebarConfig . logoHeight ,
49- display : 'flex' ,
50- flexFlow : 'row nowrap' ,
51- alignItems : 'center' ,
52- marginBottom : - 14 ,
40+ const useStyles = makeStyles ( ( ) => ( {
41+ pageWithoutFixHeight : {
42+ '> div[class*="-sidebarLayout"]' : {
43+ height : '100vh' ,
44+ display : 'flex' ,
45+ flexDirection : 'column' ,
46+ } ,
47+ '> div > main' : {
48+ height : 'unset' ,
49+ flexGrow : 1 ,
50+ } ,
51+ '.techdocs-reader-page > main' : {
52+ height : 'unset' ,
53+ } ,
5354 } ,
54- link : {
55- width : sidebarConfig . drawerWidthClosed ,
56- marginLeft : 24 ,
55+ sidebarItem : {
56+ textDecorationLine : 'none' ,
5757 } ,
58- } ) ;
58+ sidebarLayout : {
59+ '& div[class*="BackstageSidebar-drawer"]' : {
60+ top : 'var(--global-header-default-height, 64px)' ,
61+ height : 'calc(100vh - var(--global-header-default-height, 64px))' ,
62+ } ,
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+ } ) ) ;
5977
60- const SidebarLogo = ( ) => {
61- const classes = useSidebarLogoStyles ( ) ;
62- const { isOpen } = useSidebarOpenState ( ) ;
78+ export const Root = ( { children = null } : PropsWithChildren < { } > ) => {
79+ const { pageWithoutFixHeight, sidebarLayout } = useStyles ( ) ;
6380
6481 return (
65- < div className = { classes . root } >
66- < Link to = "/" underline = "none" className = { classes . link } aria-label = "Home" >
67- { isOpen ? < LogoFull /> : < LogoIcon /> }
68- </ Link >
82+ < div className = { pageWithoutFixHeight } >
83+ < div >
84+ { /* update globalHeaderMountPoints config to test Global header */ }
85+ < GlobalHeaderComponent
86+ globalHeaderMountPoints = { defaultGlobalHeaderComponentsMountPoints }
87+ />
88+ </ div >
89+ < div className = { sidebarLayout } >
90+ < SidebarPage >
91+ < Sidebar >
92+ < SidebarGroup label = "Menu" icon = { < MenuIcon /> } >
93+ { /* Global nav, not org-specific */ }
94+ < SidebarItem icon = { HomeIcon } to = "catalog" text = "Home" />
95+ < MyGroupsSidebarItem
96+ singularTitle = "My Group"
97+ pluralTitle = "My Groups"
98+ icon = { GroupIcon }
99+ />
100+ < SidebarItem icon = { ExtensionIcon } to = "api-docs" text = "APIs" />
101+ < SidebarItem icon = { LibraryBooks } to = "docs" text = "Docs" />
102+ < NotificationsSidebarItem
103+ webNotificationsEnabled
104+ titleCounterEnabled
105+ snackbarEnabled
106+ />
107+ { /* End global nav */ }
108+ < SidebarDivider />
109+ < SidebarScrollWrapper >
110+ { /* Items in this group will be scrollable if they run out of space */ }
111+ </ SidebarScrollWrapper >
112+ </ SidebarGroup >
113+ < SidebarSpace />
114+ < SidebarDivider />
115+ </ Sidebar >
116+ { children }
117+ </ SidebarPage >
118+ </ div >
69119 </ div >
70120 ) ;
71121} ;
72-
73- export const Root = ( { children = null } : PropsWithChildren < { } > ) => (
74- < SidebarPage >
75- { /* update globalHeaderMountPoints config to test Global header */ }
76- < GlobalHeaderComponent
77- globalHeaderMountPoints = { defaultGlobalHeaderComponentsMountPoints }
78- />
79- < Sidebar >
80- < SidebarLogo />
81- < SidebarGroup label = "Menu" icon = { < MenuIcon /> } >
82- { /* Global nav, not org-specific */ }
83- < SidebarItem icon = { HomeIcon } to = "catalog" text = "Home" />
84- < MyGroupsSidebarItem
85- singularTitle = "My Group"
86- pluralTitle = "My Groups"
87- icon = { GroupIcon }
88- />
89- < SidebarItem icon = { ExtensionIcon } to = "api-docs" text = "APIs" />
90- < SidebarItem icon = { LibraryBooks } to = "docs" text = "Docs" />
91- < NotificationsSidebarItem
92- webNotificationsEnabled
93- titleCounterEnabled
94- snackbarEnabled
95- />
96- { /* End global nav */ }
97- < SidebarDivider />
98- < SidebarScrollWrapper >
99- { /* Items in this group will be scrollable if they run out of space */ }
100- </ SidebarScrollWrapper >
101- </ SidebarGroup >
102- < SidebarSpace />
103- < SidebarDivider />
104- </ Sidebar >
105- { children }
106- </ SidebarPage >
107- ) ;
0 commit comments