Skip to content

Commit 77fa521

Browse files
committed
Style errors
1 parent db405b9 commit 77fa521

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

playground/src/index.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,32 @@ main {
143143
}
144144

145145
.preview-error {
146-
border: 1px solid red;
146+
color: #be0924;
147+
padding: 0.5rem 1.5rem;
148+
}
149+
150+
.preview-error pre {
151+
color: #111;
152+
}
153+
154+
.compile-error {
155+
color: #be0924;
156+
position: fixed;
157+
top: 3.4rem;
158+
background-color: white;
159+
margin: 1.5rem;
160+
border: 1px solid #be0924;
161+
padding: 0 0.5rem 0.5rem 0.5rem;
162+
border-radius: 4px;
163+
z-index: 4;
164+
}
165+
166+
.compile-error pre {
167+
color: #111;
168+
white-space: normal;
169+
}
170+
171+
.with-error {
172+
opacity: 0.8;
173+
filter: blur(1.5px);
147174
}

playground/src/preview.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function Preview(props) {
2222
function ErrorFallback({ error }) {
2323
return (
2424
<div className="preview-error">
25-
<p>Something went wrong:</p>
25+
<h3>Runtime Error:</h3>
2626
<pre>{String(error)}</pre>
2727
</div>
2828
);
@@ -61,10 +61,15 @@ function InnerPreview({ input }) {
6161
return (
6262
<>
6363
<style>{input.css}</style>
64-
<div className="preview-container">
64+
{error ? (
65+
<div className="compile-error">
66+
<h3>Compliation Error:</h3>
67+
<pre>{error}</pre>
68+
</div>
69+
) : null}
70+
<div className={`preview-container ${error ? "with-error" : ""}`}>
6571
{Content ? <Content components={{ CH }} /> : null}
6672
</div>
67-
{error ? <div className="preview-error">{error}</div> : null}
6873
</>
6974
);
7075
}

0 commit comments

Comments
 (0)