1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00
festa/components/editable/EditableMarkdown.tsx
2022-06-04 05:13:19 +02:00

15 lines
No EOL
500 B
TypeScript

import { HTMLProps } from "react";
import { EditingContext } from "../../contexts/editing";
import { useDefinedContext } from "../../utils/definedContext";
import { FestaMarkdown } from "../extensions/FestaMarkdown";
export function EditableMarkdown({value, ...props}: HTMLProps<HTMLTextAreaElement>) {
const [editing,] = useDefinedContext(EditingContext)
return editing ? (
<textarea value={value} {...props}/>
) : (
<FestaMarkdown markdown={value as string}/>
)
}