@@ -77,6 +77,7 @@ export const NextLogo = forwardRef(function NextLogo(
77
77
shouldSkip : ( count ) => count === 0 ,
78
78
animationDuration : SHORT_DURATION_MS ,
79
79
} )
80
+ const [ dismissed , setDismissed ] = useState ( false )
80
81
81
82
const triggerRef = useRef < HTMLButtonElement | null > ( null )
82
83
const ref = useRef < HTMLDivElement | null > ( null )
@@ -90,15 +91,18 @@ export const NextLogo = forwardRef(function NextLogo(
90
91
setIsErrorExpanded ( hasError )
91
92
} , [ hasError ] )
92
93
94
+ const isExpanded = isErrorExpanded || disabled
95
+
93
96
return (
94
97
< div
95
98
data-next-badge-root
96
99
style = {
97
100
{
98
101
'--size' : SIZE ,
99
102
'--duration-short' : `${ SHORT_DURATION_MS } ms` ,
100
- // if the indicator is disabled and there are no errors, hide the badge
101
- display : disabled && ! hasError ? 'none' : 'block' ,
103
+ // if the indicator is disabled, hide the badge
104
+ // also allow the "disabled" state be dismissed, as long as there are no build errors
105
+ display : disabled && ( ! hasError || dismissed ) ? 'none' : 'block' ,
102
106
} as React . CSSProperties
103
107
}
104
108
>
@@ -226,9 +230,7 @@ export const NextLogo = forwardRef(function NextLogo(
226
230
gap : 2px ;
227
231
align-items : center;
228
232
padding-left : 8px ;
229
- padding-right : ${ disabled || isBuildError
230
- ? '8px'
231
- : 'calc(2px * 2)' } ;
233
+ padding-right : ${ isBuildError ? '8px' : 'calc(2px * 2)' } ;
232
234
height : var (--size-32 );
233
235
margin : 0 2px ;
234
236
border-radius : var (--rounded-full );
@@ -422,7 +424,7 @@ export const NextLogo = forwardRef(function NextLogo(
422
424
< div
423
425
data-next-badge
424
426
data-error = { hasError }
425
- data-error-expanded = { isErrorExpanded }
427
+ data-error-expanded = { isExpanded }
426
428
data-animate = { newErrorDetected }
427
429
style = { {
428
430
width : hasError && width > SIZE_PX ? width : SIZE ,
@@ -441,7 +443,7 @@ export const NextLogo = forwardRef(function NextLogo(
441
443
< NextMark isLoading = { isLoading } isDevBuilding = { isDevBuilding } />
442
444
</ button >
443
445
) }
444
- { isErrorExpanded && (
446
+ { isExpanded && (
445
447
< div data-issues >
446
448
< button
447
449
data-issues-open
@@ -470,12 +472,16 @@ export const NextLogo = forwardRef(function NextLogo(
470
472
) }
471
473
</ div >
472
474
</ button >
473
- { ! disabled && ! isBuildError && (
475
+ { ! isBuildError && (
474
476
< button
475
477
data-issues-collapse
476
478
aria-label = "Collapse issues badge"
477
479
onClick = { ( ) => {
478
- setIsErrorExpanded ( false )
480
+ if ( disabled ) {
481
+ setDismissed ( true )
482
+ } else {
483
+ setIsErrorExpanded ( false )
484
+ }
479
485
// Move focus to the trigger to prevent having it stuck on this element
480
486
triggerRef . current ?. focus ( )
481
487
} }
0 commit comments