Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

Morozow PR#3

Open
lumejiodev wants to merge 7 commits into
lumejiodev:masterfrom
AndreyMorozow:master
Open

Morozow PR#3
lumejiodev wants to merge 7 commits into
lumejiodev:masterfrom
AndreyMorozow:master

Conversation

@lumejiodev
Copy link
Copy Markdown
Owner

No description provided.

@lumejiodev
Copy link
Copy Markdown
Owner Author

lumejiodev commented Dec 24, 2018

Прежде чем делать коммит, убедись что у тебя линтеры не ругаются. Я взял репозиторий в текущем состоянии и мне высыпалось 2 ворнинга.

Называй файлы компонентов в формате, например AddPersonsContainer/index.js, а не AddPersonsContainer/AddPersonsContainer.js. Меньше путаницы будет, более короткие записи; i.e. для импорта тебе достаточно будет написать import './AddPersonsContainer';, а не import './AddPersonsContainer/AddPersonsContainer';

Итого по общим правкам:

  • устранить все предупреждения и ошибки линтеров
  • переименовать файлы компонентов и соответственно поправить импорты компонентов

import React from 'react';
import styled from 'styled-components';
import AddPersonsForm from '../AddPersonsForm/AddPersonsForm';
const AddPersonsContainer = styled.div`
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

в LeaderBord используются почти идентичные элементы (контейнер, хедер, тайтл). Тебе нужно создать папку /components/common/ и в ней создать файлы с "общими" компонентами. То есть тебе нужно вынести PersonsContainer, PageHeader и PageHeaderTitle в отдельные компоненты, которые потом импортировать здесь и в LeaderBord.
Естественно, при необходимости можно и нужно здесь модифицировать их (например добавить нужные background-color для PageHeader)

@@ -0,0 +1,101 @@
import React, {Fragment} from 'react';
import styled from 'styled-components';
import {Trophy} from 'styled-icons/fa-solid/Trophy';
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

этот пакет позволяет импортировать иконки таким образом: import {Anchor, Star, Trophy} from 'styled-icons/fa-solid';. Чище и короче

<PageHeaderTitle>Лидеры</PageHeaderTitle>
</PageHeader>
<LeaderBordContent>
<LeaderBordBlank name="Петр Иванов" score="8901 очков" picture={rank1}/>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Здесь ок

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Но кол-чо очков лучше передавать просто числом. Это удобнее и так чаще будет встречаться в реальных условиях )

const paginationButtons = () => {
return (
<PagintionButtonsContainer>
<PaginationButtonsList>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Попробуй здесь вывести кнопки циклом

justify-content: space-between;
`;

const pagecontainer = () => {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Старайся поменьше грязи делать. Здесь камелКейс не учёл, местами точки с запятой в конце строки забываешь и прочие мелочи

Comment thread react-2up/Redux-basic.js
@@ -0,0 +1,47 @@
const redux = require('redux');
const createStore = redux.createStore;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Надо использовать ES6 импорт:
import { createStore } from 'redux';

<LeaderBordBlank name="Иван Иванов" score="8701 очков" picture={rank3}/>
<LeaderBordBlank name="Петр Петров" score="8601 очков" picture=""/>
<LeaderBordBlank name="Петр Петров" score="8501 очков" picture=""/>
<LeaderBordBlank name={this.props.name} score={this.props.score} picture={rank1}/>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Лучше объявить переменные name и score через деструктуризацию


const pageHeader = (props) => {
return (
<PageHeader>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

чтобы работало условие нужно этот prop прокинуть в
ex: <PageHeader color={false}>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants