@@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
55import {
66 Breadcrumb , Col , Container , Row , Button , Badge ,
77 Stack ,
8- useMediaQuery ,
8+ useWindowSize ,
99 breakpoints ,
1010} from '@openedx/paragon' ;
1111
@@ -40,7 +40,10 @@ export const ActionButton = ({ label, icon, onClick }: Action) => (
4040const AuthZTitle = ( {
4141 activeLabel, navLinks = [ ] , pageTitle, pageSubtitle, actions = [ ] ,
4242} : AuthZTitleProps ) => {
43- const isDesktop = useMediaQuery ( { minWidth : breakpoints . large . minWidth } ) ;
43+ const { width = window . innerWidth } = useWindowSize ( ) ;
44+ const minWidth = breakpoints . large ?. minWidth || 1200 ;
45+ const isDesktop = width > minWidth ;
46+
4447 return (
4548 < Container className = "p-5 bg-light-100" >
4649 < Breadcrumb
@@ -58,22 +61,22 @@ const AuthZTitle = ({
5861 < Col xs = { 12 } md = { 5 } >
5962 < Stack className = "justify-content-end" direction = { isDesktop ? 'horizontal' : 'vertical' } >
6063 {
61- actions . map ( ( action , index ) => {
62- const content = isValidElement ( action )
63- ? action
64- : < ActionButton { ...action as Action } /> ;
65- const key = isValidElement ( action )
66- ? action . key
67- : ( action as Action ) . label ;
68- return (
69- < Fragment key = { `authz-header-action-${ key } ` } >
70- { content }
71- { ( index === actions . length - 1 ) ? null
72- : ( < hr className = "mx-lg-5" /> ) }
73- </ Fragment >
74- ) ;
75- } )
76- }
64+ actions . map ( ( action , index ) => {
65+ const content = isValidElement ( action )
66+ ? action
67+ : < ActionButton { ...action as Action } /> ;
68+ const key = isValidElement ( action )
69+ ? action . key
70+ : ( action as Action ) . label ;
71+ return (
72+ < Fragment key = { `authz-header-action-${ key } ` } >
73+ { content }
74+ { ( index === actions . length - 1 ) ? null
75+ : ( < hr className = "mx-lg-5" /> ) }
76+ </ Fragment >
77+ ) ;
78+ } )
79+ }
7780 </ Stack >
7881 </ Col >
7982 </ Row >
0 commit comments