Skip to content

Commit

Permalink
added improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sheva10barca committed Jul 19, 2023
1 parent 8405779 commit a436864
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const App: React.FC = () => {
</div>
)}

{userPosts.length > 0 && (
{userPosts.length > 0 && !isLoading && (
<PostsList
userPosts={userPosts}
handleSelectPost={handleSelectPost}
Expand Down
20 changes: 15 additions & 5 deletions src/components/NewCommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const NewCommentForm: React.FC<Props> = ({
setIsCommentTextError(false);
}

if (name.trim().length
if (
name.trim().length
&& email.trim().length
&& commentText.trim().length
) {
Expand Down Expand Up @@ -88,7 +89,10 @@ export const NewCommentForm: React.FC<Props> = ({
'is-danger': isNameError,
})}
value={name}
onChange={(e) => setName(e.target.value)}
onChange={(e) => {
setName(e.target.value);
setIsNameError(false);
}}
/>

<span className="icon is-small is-left">
Expand Down Expand Up @@ -119,15 +123,18 @@ export const NewCommentForm: React.FC<Props> = ({

<div className="control has-icons-left has-icons-right">
<input
type="text"
type="email"
name="email"
id="comment-author-email"
placeholder="email@test.com"
className={cn('input', {
'is-danger': isEmailError,
})}
value={email}
onChange={(e) => setEmail(e.target.value)}
onChange={(e) => {
setEmail(e.target.value);
setIsEmailError(false);
}}
/>

<span className="icon is-small is-left">
Expand Down Expand Up @@ -165,7 +172,10 @@ export const NewCommentForm: React.FC<Props> = ({
'is-danger': isCommentTextError,
})}
value={commentText}
onChange={(e) => setCommentText(e.target.value)}
onChange={(e) => {
setCommentText(e.target.value);
setIsCommentTextError(false);
}}
/>
</div>

Expand Down

0 comments on commit a436864

Please sign in to comment.