perf: md rendering only if preview

This commit is contained in:
Artemy 2022-10-17 17:21:43 +03:00
parent f6a7d6fdd3
commit f4fb0d8894
2 changed files with 9 additions and 9 deletions

View file

@ -14,7 +14,7 @@ function Menu() {
<MagnifyingGlassCircleIcon className="transform translate-z-0 h-7 w-7" /> <MagnifyingGlassCircleIcon className="transform translate-z-0 h-7 w-7" />
} }
> >
Записки Заметки
</IconWithButton> </IconWithButton>
</Button> </Button>
<Button href="/"> <Button href="/">

View file

@ -12,7 +12,7 @@ function CreateNote() {
<div> <div>
<div className="grid grid-cols-1 lg:grid-cols-2"> <div className="grid grid-cols-1 lg:grid-cols-2">
<h2 className="font-medium text-center lg:text-left leading-tight text-4xl mt-0 mb-2"> <h2 className="font-medium text-center lg:text-left leading-tight text-4xl mt-0 mb-2">
Написать записку Написать заметку
</h2> </h2>
<CheckBox <CheckBox
className="justify-self-center lg:justify-self-end" className="justify-self-center lg:justify-self-end"
@ -22,11 +22,11 @@ function CreateNote() {
/> />
</div> </div>
{preview && (
<div className="w-full md"> <div className="w-full md">
<ReactMarkdown className={!preview ? "hidden" : ""}> <ReactMarkdown>{text}</ReactMarkdown>
{text}
</ReactMarkdown>
</div> </div>
)}
<textarea <textarea
className={` className={`
@ -54,7 +54,7 @@ function CreateNote() {
${preview ? "hidden" : ""} ${preview ? "hidden" : ""}
`} `}
rows="10" rows="10"
placeholder="Ваша записка начинается здесь. Можно использовать markdown..." placeholder="Ваша заметка начинается здесь. Можно использовать markdown..."
maxLength={5000} maxLength={5000}
onChange={(e) => { onChange={(e) => {
setText(e.target.value); setText(e.target.value);
@ -63,7 +63,7 @@ function CreateNote() {
<div className="grid grid-cols-1 lg:grid-cols-2 justify-items-center w-full"> <div className="grid grid-cols-1 lg:grid-cols-2 justify-items-center w-full">
<CheckBox <CheckBox
className="justify-self-center lg:justify-self-start" className="justify-self-center lg:justify-self-start"
label="Публичная записка" label="Публичная заметка"
id="public" id="public"
onClick={""} onClick={""}
checked checked