You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
954 B

import React, { useState } from "react";
import ReactMarkdown from "react-markdown";
import { noop } from "../../utils";
import "./EditableNoteArea.css";
export default function EditableNoteArea({
content = "",
onSave = noop,
preview = false
}) {
// const [newContent, setNewContent] = useState(content);
const updateContent = ({ target: { value } }) => {
// setNewContent(value);
onSave(value);
};
return (
<section className="EditableNoteArea">
{!preview ? (
<textarea
resizeable={false}
value={content}
placeholder="This note feels cold and empty inside"
onChange={updateContent}
/>
) : (
<div className="markdownPreview">
<ReactMarkdown source={content} />
</div>
)}
</section>
);
}