Skip to content

Commit 0e6e55b

Browse files
committed
Render css
1 parent cb5a4c4 commit 0e6e55b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

playground/src/app.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ print("This is Code Hike")
1515
1616
`;
1717

18+
const defaultCss = `.preview-container {
19+
margin: 8px;
20+
}`;
21+
1822
function App() {
1923
const defaultInput = React.useMemo(() => {
2024
return (
2125
readHash() || {
2226
mdx: defaultCode,
23-
css: ".preview-container { border: 1px solid blue; }",
27+
css: defaultCss,
2428
config: { lineNumbers: false, showCopyButton: false },
2529
}
2630
);

playground/src/index.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ main {
111111
.preview {
112112
min-width: 600px;
113113
border-left: 2px solid cadetblue;
114-
padding: 1em;
115114
flex: 1;
116115
min-height: 0;
117116
overflow: auto;

playground/src/preview.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ function InnerPreview({ input }) {
5353
// console.log(error);
5454
return (
5555
<>
56-
{Content ? <Content components={{ CH }} /> : null}
56+
<style>{input.css}</style>
57+
<div className="preview-container">
58+
{Content ? <Content components={{ CH }} /> : null}
59+
</div>
5760
{error ? <div className="preview-error">{error}</div> : null}
5861
</>
5962
);

0 commit comments

Comments
 (0)