Skip to content

Commit

Permalink
Solution v 0.91
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasyl Zhyliakov committed Oct 27, 2024
1 parent 251004b commit 3aa6d6d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
12 changes: 0 additions & 12 deletions src/api/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,3 @@ export const createComment = ({
}: Omit<Comment, 'id'>) => {
return client.post<Comment>('/comments', { postId, name, email, body });
};

// export interface Comment {
// id: number;
// postId: number;
// name: string;
// email: string;
// body: string;
// }

// export const updateTodo = ({ id, title, completed }: Omit<Todo, 'userId'>) => {
// return client.patch<Todo>(`/todos/${id}`, { title, completed });
// };
6 changes: 5 additions & 1 deletion src/components/NewCommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export const NewCommentForm: React.FC<Props> = ({
};

return (
<form data-cy="NewCommentForm" onSubmit={handleSubmit} onReset={handleReset}>
<form
data-cy="NewCommentForm"
onSubmit={handleSubmit}
onReset={handleReset}
>
<div className="field" data-cy="NameField">
<label className="label" htmlFor="comment-author-name">
Author Name
Expand Down
5 changes: 4 additions & 1 deletion src/components/OneUser.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { User } from '../types/User';
import cn from 'classnames';

type Props = {
user: User;
selectedUserId: number | null;
setSelectedUserId: (id: number | null) => void;
setIsDropDownOpen: (status: boolean) => void;
};

export const OneUser: React.FC<Props> = ({
user,
selectedUserId,
setSelectedUserId,
setIsDropDownOpen,
}) => {
Expand All @@ -19,7 +22,7 @@ export const OneUser: React.FC<Props> = ({
return (
<a
href={`#user-${user.id}`}
className="dropdown-item"
className={cn("dropdown-item", {'is-active': selectedUserId === user.id})}
onClick={handleUserSelect}
>
{user.name}
Expand Down
5 changes: 1 addition & 4 deletions src/components/PostsList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import cn from 'classnames';
import { Post } from '../types/Post';
import { OnePost } from './OnePost';

Expand All @@ -18,9 +17,7 @@ export const PostsList: React.FC<Props> = ({
<p className="title">Posts:</p>

<table
className={cn('table is-striped is-hoverable is-narrow', {
'is-fullwidth': !activePostId,
})}
className='table is-striped is-hoverable is-narrow is-fullwidth'
>
<thead>
<tr className="has-background-link-light">
Expand Down
1 change: 1 addition & 0 deletions src/components/UserSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const UserSelector: React.FC<Props> = ({
<OneUser
user={user}
key={user.id}
selectedUserId={selectedUserId}
setSelectedUserId={setSelectedUserId}
setIsDropDownOpen={setIsDropDownOpen}
/>
Expand Down

0 comments on commit 3aa6d6d

Please sign in to comment.