-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a page that allow me to view how the Markdown syntax would be rendered to before submitting it in the backend
- Loading branch information
1 parent
0aff524
commit 3758f63
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useState } from 'react'; | ||
import HTMLMarkdown from '../../components/HTMLMarkdown'; | ||
import ContainerWrap from '../../components/ContainerWrap'; | ||
|
||
const MarkdownEditor = () => { | ||
const [markdown, setMarkdown] = useState<string>(''); | ||
|
||
const handleMarkdownChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
setMarkdown(event.target.value); | ||
}; | ||
|
||
return ( | ||
<div style={{ display: 'grid' }}> | ||
<textarea | ||
style={{ | ||
flex: 1, | ||
minHeight: '150px', | ||
padding: '15px', | ||
fontSize: '16px', | ||
resize: 'vertical', | ||
border: '1px solid #ccc', | ||
borderRadius: '8px', | ||
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)', | ||
outline: 'none', | ||
fontFamily: 'Arial, sans-serif', | ||
lineHeight: '1.5', | ||
marginBottom: '20px', | ||
transition: 'border-color 0.3s, box-shadow 0.3s', | ||
}} | ||
value={markdown} | ||
onChange={handleMarkdownChange} | ||
placeholder="Write your Markdown here..." | ||
/> | ||
<div style={{ flex: 1, padding: '10px', borderTop: '1px solid #ccc' }}> | ||
<HTMLMarkdown markdown={markdown} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ContainerWrap(MarkdownEditor); |