1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-24 07:34:23 +00:00
festa/components/editable/EditableMarkdown.tsx

19 lines
No EOL
610 B
TypeScript

import { HTMLProps } from "react";
import { FestaMarkdown } from "../extensions/FestaMarkdown";
import { Editable } from "./Editable";
/**
* Controlled input component which displays a `textarea` in editing mode, and renders the input in Markdown using {@link FestaMarkdown} in preview mode.
*/
export function EditableMarkdown(props: HTMLProps<HTMLTextAreaElement> & { value: string }) {
return (
<Editable
editing={
<textarea {...props} />
}
preview={
<FestaMarkdown markdown={props.value} />
}
/>
)
}