-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson 4 #9
Conversation
.storybook/addons.js
Outdated
@@ -0,0 +1 @@ | |||
import 'storybook-addon-react-docgen/register'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main.js
в "новых" рекомендациях указано проводить настройки в данный файл, давай сделаем все в одном стиле?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -23,7 +23,21 @@ module.exports = { | |||
], | |||
enforce: 'pre', | |||
}); | |||
|
|||
config.module.rules.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А это заработало?
// 2b. Run `source-loader` on story files to show their source code
// automatically in `DocsPage` or the `Source` doc block.
https://github.com/storybookjs/storybook/tree/master/addons/docs#manual-configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно будет посмотреть исходный код прямо в addon )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну я подключил, но видимо из-за того что docs не подключен - никаких изменений не вижу
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
подключил - но плюсов не увидел, если поможешь с mdx будет круто )
@@ -1 +1,5 @@ | |||
import 'loki/configure-react'; | |||
import { addDecorator } from '@storybook/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно обойтись без декораторов
https://github.com/storybookjs/storybook/tree/master/addons/docs#manual-configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это другой аддон, на сколько я вижу
у меня используется https://www.npmjs.com/package/storybook-addon-react-docgen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я конечно не настаиваю, хотя популярность и возможности сильно отличаются )
https://github.com/storybookjs/storybook/tree/master/addons/docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
честно - я потратил часов 5, но mdx у меня так и не заработал ))
я помню, что ты его хотел
__mocks__/styleMock.js
Outdated
@@ -0,0 +1,3 @@ | |||
// https://jestjs.io/docs/en/webpack#handling-static-assets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно использовать директорию internals
для такого рода настроек и конфигов
@@ -0,0 +1,20 @@ | |||
.cell { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю сделать как обсуждали
- перенести калькулятор из директории
src/lesson2
на уровень выше и назвать эту директорию чем то вродеcalc
- удалить все тестовые компоненты из
src
- добавить код в директорию
src/components
Дальше будем разрабатывать шаг за шагом приложение)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тогда сначала нужно поставить теги и обновить README (потому что это поломает примеры, которые ты давал)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Согласен, с меня теги по первым урокам)
По поводу обновления readme, у нас же там ссылка на pull request, соответственно изменения ничего не поломают, можно будет переключиться по истории изменений на нужное состояние.
Так же можно открыть сам pull request и посмотреть изменения
src/lesson4/Field.tsx
Outdated
x={x} | ||
y={y} | ||
onClick={props.onClick} | ||
key={`${x}_${y}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может стоит сделать key
первым свойством?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
оно сделано последним, потому что он нем речи еще не было
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Принял - понял)
src/lesson4/Field.tsx
Outdated
|
||
export default Field; | ||
|
||
export function getField(props: FieldProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short arrow functions notation ? export getField = () => <Field {...props} />
...row.map((filled, x) => { | ||
return getCell({ | ||
onClick: props.onClick, | ||
filled: filled ? filled : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filled?: string;
насколько я вижу из интерфейса, почему бы не использовать это?
в этом случае, если он потенциально undefined
{
onClick: props.onClick,
filled,
//...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это сделано чтобы пустая строка обрабатывалась как undefined
/** | ||
* x-size for field | ||
*/ | ||
xSize: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizes: { x: number, y: number }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну тут тот же аргумент что и с x,y (хотя здесь мы вроде менять не собираемся часто)
src/lesson4/InteractiveField.tsx
Outdated
|
||
public onClick(x: number, y: number) { | ||
if ( | ||
y >= 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, стоит сделать логическую переменную с читаемым названием
const playerCanPutMark = y >= 0 &&
y < this.state.fieldState.length &&
x >= 0 &&
x < this.state.fieldState[0].length`
README.md
Outdated
[Pull request](https://github.com/nickovchinnikov/react-js-tutorial/pull/9) | ||
|
||
[Presentation](https://docs.google.com/presentation/d/1TVkOviAfORwmYncUL51g2UboNtj8kczWoLIRL3hO7AE/edit?usp=sharing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А можем презентации хранить в одном спейсе?
Можешь переместить на нашу общую папку, плиз?
Что сделано: