Skip to content

Commit fef9812

Browse files
Merge pull request #36 from WebDevSimplified/markdown-crash-course
Add Markdown Article
2 parents 877643a + 6141a9d commit fef9812

File tree

6 files changed

+40
-70
lines changed

6 files changed

+40
-70
lines changed

package-lock.json

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"react": "^18.2.0",
2727
"react-dom": "^18.2.0",
2828
"react-markdown": "^8.0.7",
29-
"react-scroll-sync": "^0.11.0",
3029
"rehype-raw": "^6.1.1",
3130
"remark-gfm": "^3.0.1",
3231
"specificity": "^0.4.1"
Loading
Loading
Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { useState } from "react"
22
import ReactMarkdown from "react-markdown"
3-
import { ScrollSync, ScrollSyncPane } from "react-scroll-sync"
43
import remarkGfm from "remark-gfm"
54
import rehypeRaw from "rehype-raw"
65
import "github-markdown-css/github-markdown-dark.css"
7-
import "./markdownEditor.css"
6+
import "./MarkdownEditor.css"
87

98
export default function MarkdownEditor({
109
initialValue = "",
@@ -14,56 +13,50 @@ export default function MarkdownEditor({
1413
const [value, setValue] = useState(initialValue)
1514
return (
1615
<div style={{ height }}>
17-
<ScrollSync>
16+
<div
17+
className={isFullWidth ? "full-width-article-element" : ""}
18+
style={{
19+
display: "flex",
20+
alignItems: "stretch",
21+
height,
22+
marginTop: "1rem",
23+
}}
24+
>
25+
<textarea
26+
value={value}
27+
onChange={e => setValue(e.target.value)}
28+
style={{
29+
resize: "none",
30+
flexGrow: 0,
31+
flexShrink: 0,
32+
fontSize: "inherit",
33+
padding: "1rem",
34+
overflowY: "auto",
35+
width: "50%",
36+
borderRadius: 0,
37+
}}
38+
/>
1839
<div
19-
className={isFullWidth ? "full-width-article-element" : ""}
40+
className="markdown-body"
2041
style={{
21-
display: "flex",
22-
alignItems: "stretch",
23-
height,
24-
marginTop: "1rem",
42+
border: "1px solid var(--theme-text-lighter)",
43+
borderLeft: "none",
44+
width: "50%",
45+
flexGrow: 0,
46+
flexShrink: 0,
47+
padding: "1rem",
48+
overflowY: "auto",
49+
color: "var(--color-white)",
2550
}}
2651
>
27-
<ScrollSyncPane>
28-
<textarea
29-
value={value}
30-
onChange={e => setValue(e.target.value)}
31-
style={{
32-
resize: "none",
33-
flexGrow: 0,
34-
flexShrink: 0,
35-
fontSize: "inherit",
36-
padding: "1rem",
37-
overflowY: "auto",
38-
width: "50%",
39-
borderRadius: 0,
40-
}}
41-
/>
42-
</ScrollSyncPane>
43-
<ScrollSyncPane>
44-
<div
45-
className="markdown-body"
46-
style={{
47-
border: "1px solid var(--theme-text-lighter)",
48-
borderLeft: "none",
49-
width: "50%",
50-
flexGrow: 0,
51-
flexShrink: 0,
52-
padding: "1rem",
53-
overflowY: "auto",
54-
color: "var(--color-white)",
55-
}}
56-
>
57-
<ReactMarkdown
58-
rehypePlugins={[rehypeRaw]}
59-
remarkPlugins={[remarkGfm]}
60-
>
61-
{value}
62-
</ReactMarkdown>
63-
</div>
64-
</ScrollSyncPane>
52+
<ReactMarkdown
53+
rehypePlugins={[rehypeRaw]}
54+
remarkPlugins={[remarkGfm]}
55+
>
56+
{value}
57+
</ReactMarkdown>
6558
</div>
66-
</ScrollSync>
59+
</div>
6760
</div>
6861
)
6962
}

src/styles/blog.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ kbd {
220220
max-width: 125ch;
221221
padding-left: 2rem;
222222
padding-right: 2rem;
223-
width: 100vw;
224223
position: absolute;
225224
left: 0;
226225
right: 0;

0 commit comments

Comments
 (0)