Skip to content

Commit 131ca4f

Browse files
committed
fix ErrorBar: don't take space when hidden
1 parent 76a1f29 commit 131ca4f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/ErrorBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSProperties, useState } from 'react'
1+
import { useState } from 'react'
22
import { useConfig } from '../hooks/useConfig.js'
33
import { cn } from '../lib/utils.js'
44
import styles from '../styles/ErrorBar.module.css'
@@ -21,7 +21,7 @@ export default function ErrorBar({ error }: ErrorBarProps) {
2121

2222
return <div
2323
className={cn(styles.errorBar, customClass?.errorBar)}
24-
style={{ '--error-bar-visibility': showError ? 'visible' : 'hidden' } as CSSProperties}
24+
data-visible={showError}
2525
>
2626
<div>
2727
<span>{error?.toString()}</span>

src/styles/ErrorBar.module.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.errorBar {
2-
visibility: var(--error-bar-visibility, hidden);
2+
display: none;
33
max-height: 30%;
44
padding: 0;
55
background-color: #dd111199;
@@ -8,6 +8,10 @@
88
white-space: pre-wrap;
99
font-family: monospace;
1010

11+
&[data-visible="true"] {
12+
display: block;
13+
}
14+
1115
& > div {
1216
display: flex;
1317
align-items: center;

0 commit comments

Comments
 (0)