Skip to content

Commit

Permalink
feat: show field error message in preview mode (#2418)
Browse files Browse the repository at this point in the history
* feat: show field error message in preview mode

* fix: add renderComment function and change ' ' to null

* fix: change renderComment function
  • Loading branch information
Zoro444 authored Feb 4, 2024
1 parent cea14a4 commit 3972cd4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/src/components/Forms/MarkdownInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export default function MarkdownInput({ historicalCommentSelected }: Props) {
setText('');
};

const renderComment = () => {
return (
<Typography.Paragraph type="danger">
{!text ? 'Please leave a comment' : 'Please leave a detailed comment'}
</Typography.Paragraph>
);
};

const link = (
<span style={{ marginLeft: '20px' }}>
<a
Expand Down Expand Up @@ -58,6 +66,7 @@ export default function MarkdownInput({ historicalCommentSelected }: Props) {
<ReactMarkdown rehypePlugins={[remarkGfm]}>{text}</ReactMarkdown>
</Typography.Text>
</div>
{(!text || text?.length < 30) && renderComment()}
<Button onClick={toggleView}>Write</Button> {link}
</div>
) : (
Expand Down

0 comments on commit 3972cd4

Please sign in to comment.