@@ -41,6 +41,7 @@ export type Components = UnifiedThemeOptions['components'] & {
4141 BackstageTableToolbar ?: Component ;
4242 CatalogReactUserListPicker ?: Component ;
4343 PrivateTabIndicator ?: Component ;
44+ RHDHPageWithoutFixHeight ?: Component ;
4445} ;
4546
4647export const createComponents = ( themeConfig : ThemeConfig ) : Components => {
@@ -95,9 +96,15 @@ export const createComponents = (themeConfig: ThemeConfig): Components => {
9596 if ( options . buttons !== 'mui' ) {
9697 components . MuiTypography = {
9798 styleOverrides : {
98- button : {
99- textTransform : 'none' ,
99+ root : {
100+ fontFamily : redHatFonts . text ,
100101 fontWeight : 'normal' ,
102+ letterSpacing : '0.01em' ,
103+ // This is required to override the default MUI styles
104+ // that set the `font-weight` to `500` for the `h1` element.
105+ '&.MuiTypography-h1' : {
106+ fontWeight : 'normal' ,
107+ } ,
101108 } ,
102109 } ,
103110 } ;
@@ -626,6 +633,10 @@ export const createComponents = (themeConfig: ThemeConfig): Components => {
626633 borderRadius : '6px' ,
627634 width : 'calc(100% - 0.5rem) !important' ,
628635 marginLeft : '0.5rem !important' ,
636+ textDecorationLine : 'none' ,
637+ '&:hover, &:focus-visible' : {
638+ backgroundColor : general . sidebarItemSelectedBackgroundColor ,
639+ } ,
629640 } ,
630641 label : {
631642 '&[class*="MuiTypography-subtitle2"]' : {
@@ -683,30 +694,58 @@ export const createComponents = (themeConfig: ThemeConfig): Components => {
683694 }
684695
685696 if ( options . pages !== 'mui' ) {
697+ components . RHDHPageWithoutFixHeight = {
698+ styleOverrides : {
699+ root : {
700+ // Cancel out the spacing produced by the page inset border when
701+ // the global header is present in the above-sidebar position.
702+ '@media (min-width: 600px)' : {
703+ '#above-sidebar-header-container:has(*) ~ [class*="sidebarLayout"]' :
704+ {
705+ "& [class*='BackstagePage-root'], & [class*='MuiLinearProgress-root']" :
706+ {
707+ marginTop : '0 !important' ,
708+ } ,
709+ } ,
710+ } ,
711+ } ,
712+ sidebarLayout : {
713+ // Cancel out the spacing produced by the page inset border when
714+ // the global header is present in the above-main-content position.
715+ '@media (min-width: 600px)' : {
716+ '#above-main-content-header-container:has(*)' : {
717+ "& ~ [class*='BackstagePage-root'], & ~ [class*='MuiLinearProgress-root']" :
718+ {
719+ marginTop : '0 !important' ,
720+ } ,
721+ } ,
722+ } ,
723+ } ,
724+ } ,
725+ } ;
686726 components . BackstageSidebarPage = {
687727 styleOverrides : {
688728 root : {
689729 // Controls the page inset as in PF6 -- only in desktop view
690730 '@media (min-width: 600px)' : {
691- // The size of the page inset border
692- '--rhdh-v1-page-inset' : '1.5rem' ,
693731 backgroundColor : general . sidebarBackgroundColor ,
694- // Cancel out the spacing produced by the page inset border when
695- // the global header is present
696- "& #global-header ~ main, & #global-header ~ [class*='MuiLinearProgress-root'], & #above-main-content-header-container ~ main, & #above-main-content-header-container ~ [class*='MuiLinearProgress-root']" :
697- {
698- marginTop : 'calc(-1 * var(--rhdh-v1-page-inset))' ,
699- } ,
732+ // Prevents the main content from scrolling weird
733+ overflowY : 'auto' ,
700734 // Cancel out the spacing produced by the page inset border when
701735 // the sidebar is present
702- "& nav ~ main, & nav ~ [class*='MuiLinearProgress-root']" : {
703- marginLeft : 'calc(-1 * var(--rhdh-v1-page-inset))' ,
736+ '& nav' : {
737+ "& ~ main, & ~ [class*='MuiLinearProgress-root']" : {
738+ marginLeft : '0 !important' ,
739+ } ,
704740 } ,
705- // The border + border radius emulates the PF6 page inset look without
706- // needing to change the markup
707741 "& > [class*='MuiLinearProgress-root'], & > main" : {
708- borderRadius : 'calc(1rem + var(--rhdh-v1-page-inset))' ,
709- border : `var(--rhdh-v1-page-inset) solid ${ general . sidebarBackgroundColor } ` ,
742+ // clip-path clips the scrollbar properly in Chrome compared to
743+ // border-radius. 1rem is the hardcoded border-radius of the page content.
744+ clipPath : 'rect(0 100% 100% 0 round 1rem)' ,
745+ // Emulate the PatternFly 6 page inset using a margin
746+ margin : general . pageInset ,
747+ // Prevent overflow in the main container due to the margin
748+ maxHeight : `calc(100vh - 2 * ${ general . pageInset } )` ,
710749 } ,
711750 // The Backstage suspense is an MUI LinearProgress that is not wrapped by
712751 // a `main`. We need to give it 100vh height to fill the page for the page
0 commit comments