@@ -64,6 +64,8 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
6464 return warningBarOpen !== 'false' ;
6565 } ) ;
6666
67+ const isBannerClickable = sm && Boolean ( currentCampaign ?. buttonAction ) ;
68+
6769 useEffect ( ( ) => {
6870 if ( ! currentCampaign ) return ;
6971
@@ -113,6 +115,11 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
113115 }
114116 } ;
115117
118+ const handleBannerClick = ( ) => {
119+ if ( ! isBannerClickable ) return ;
120+ handleButtonAction ( ) ;
121+ } ;
122+
116123 // Note: hide warnings when mobile menu is open
117124 if ( mobileDrawerOpen ) return null ;
118125
@@ -137,7 +144,9 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
137144 justifyContent : 'center' ,
138145 alignItems : 'center' ,
139146 width : '100%' ,
147+ cursor : isBannerClickable ? 'pointer' : 'default' ,
140148 } }
149+ onClick = { handleBannerClick }
141150 variant = "dense"
142151 >
143152 < Box sx = { { padding : md ? '20px 10px' : '' , paddingRight : 0 } } >
@@ -155,7 +164,7 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
155164 ''
156165 ) }
157166
158- { currentCampaign . learnMoreLink && md ? (
167+ { md && currentCampaign . learnMoreLink && ! isBannerClickable ? (
159168 typeof currentCampaign . learnMoreLink === 'string' ? (
160169 < Link
161170 sx = { { color : 'white' , textDecoration : 'underline' , paddingLeft : 2 } }
@@ -189,7 +198,7 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
189198 </ Box >
190199
191200 < Box >
192- { ! md && currentCampaign . buttonText && currentCampaign . buttonAction ? (
201+ { ! sm && currentCampaign . buttonText && currentCampaign . buttonAction ? (
193202 < Button
194203 size = "small"
195204 onClick = { handleButtonAction }
@@ -207,7 +216,10 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
207216 </ Box >
208217 < Button
209218 sx = { { color : 'white' , paddingRight : 0 } }
210- onClick = { handleClose }
219+ onClick = { ( event ) => {
220+ event . stopPropagation ( ) ;
221+ handleClose ( ) ;
222+ } }
211223 startIcon = { < CloseIcon /> }
212224 />
213225 </ Toolbar >
0 commit comments