Skip to content

Commit

Permalink
feat: make post body editor text area bigger initially when editing l…
Browse files Browse the repository at this point in the history
…onger posts
  • Loading branch information
sunaurus committed Mar 30, 2024
1 parent d80349d commit db287f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/create_post/PostEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const PostEditor = (props: {
readonly communityName: string;
readonly communityId: number;
}) => {
const bodyLineCount =
props.existingPostView?.post.body?.split(/\r\n|\r|\n/).length ?? 0;
return (
<form
action={
Expand Down Expand Up @@ -62,8 +64,12 @@ export const PostEditor = (props: {
<label className={"block font-semibold"} htmlFor={"body"}>
{"Body"}
</label>

<TextArea
className={"mt-2 min-h-32"}
className={classNames("mt-2 min-h-32", {
"min-h-96": bodyLineCount > 5 && bodyLineCount < 15,
"min-h-[600px]": bodyLineCount >= 15,
})}
defaultValue={props.existingPostView?.post.body}
id={"body"}
name={"body"}
Expand Down

0 comments on commit db287f7

Please sign in to comment.