Skip to content

Conversation

@anutaguzova
Copy link
Owner

  1. https://github.com/rolling-scopes-school/tasks/blob/master/tasks/react/react-api.md
    2

Screenshot 2021-09-01 at 00 03 31

3. Выполнено задание согласно пунктам: строка поиска, список резульатов, переключатели сортировки, пагинация

Copy link
Collaborator

@KseniyaYatskevich KseniyaYatskevich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Использование кнопки Search для перехода на другую страницу - не лучшее решение, не понятно для пользователя

onChangeSize('5');
setSize('5');
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в данном случает также можно было бы использоать конструкцию switch

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправлено

<select name="pageSize" value={size} onChange={handleChoose} onBlur={handleChoose}>
<option value="5">5</option>
<option value="10">10</option>
<option value="20">20</option>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для option лучше создать массив значений и пройтити по этому массиву - проще измеить значения, добавить новые или удалить const pageSize = [ 5, 10, 20]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделано

src/index.tsx Outdated
import App from './App';

ReactDOM.render(
<BrowserRouter>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понимаю зачем используется Router в этом задании...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправила

import { ChangeEvent, FC, useState } from 'react';
import Articles from '../components/Articles';
import axios from '../services/api';
import { Article, Get200Articles, SortType } from '../types';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошая идея вынести типы в отдельный файл! Обычно название такого файла связано с названием файла к которому относится ComponentModel.ts

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Заменено

const [page, setPage] = useState<number>(1);
const [pageSize, setPageSize] = useState<string>('5');
const [totalPages, setTotalPages] = useState<number>(1);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Молодец, что используешь хуки

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked={sortBy === SortType.publishedAt}
onChange={() => setSortBy(SortType.publishedAt)}
/>{' '}
publishedAt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для пользователя лучше использовать что-то более понятное, хотя бы published

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Заменено на publication date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants