-
Notifications
You must be signed in to change notification settings - Fork 108
Homework #5 (Lecture 5) — Kochkina Ekaterina #353
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
Open
gudrum1983
wants to merge
16
commits into
ylabio:lecture-5
Choose a base branch
from
gudrum1983:homework-lecture-5
base: lecture-5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
913f9a3
Добавила стили и ключи с переводом
gudrum1983 ca13722
Задание 1
gudrum1983 8ad2a5a
Задание 2 - Добавила ключи в словари
gudrum1983 5cb424b
Задание 2 переписала контекст на сервис
gudrum1983 7046675
Задание обновила импорты
gudrum1983 72a2c4a
Рефакторинг 1 - пофиксить перенос длинных слов в комментарии и бескон…
gudrum1983 9e7ea83
Рефакторинг 2
gudrum1983 62ea23c
Рефакторинг 3
gudrum1983 3e9797b
fix 1 - удалила ненужный литерал из даты
gudrum1983 a8da06f
fix 3 - добавила стили текста в textarea и убрала стили дефолтного фо…
gudrum1983 e5c48c9
fix 4, 6 - проверка на пустой комментарий, формат даты, кнопка отмены
gudrum1983 20a63ec
fix 9 - удалила передачу токена
gudrum1983 2143ce9
fix 7 - возврат к текущему комментарию после логина
gudrum1983 46746cd
fix 1, 5, 10 - вернула отступы как были, открытие формы комментария ч…
gudrum1983 1afcd6e
fix - сломала скролл после авторизации, пересмотреть перерендеры и за…
gudrum1983 350a63e
рефакторинг, нейминг и консоль логи
gudrum1983 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { memo } from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { cn as bem } from '@bem-react/classname'; | ||
| import './style.css'; | ||
| import Button from '../button'; | ||
| import { Link } from 'react-router-dom'; | ||
|
|
||
| function CommentAction(props) { | ||
| const { | ||
| id='', | ||
| t = text => text, | ||
| onAdd = () => {}, | ||
| setValue = () => {}, | ||
| cancel = () => {}, | ||
| value = '', | ||
| isReply = false, | ||
| auth = false, | ||
| link = '/login', | ||
| backLink = '', | ||
| } = props; | ||
| const cn = bem('CommentAction'); | ||
|
|
||
| const label = isReply ? t('comment.newReply') : t('comment.newComment'); | ||
|
|
||
| const onChangeHandler = event => { | ||
| setValue(event.target.value); | ||
| }; | ||
|
|
||
|
|
||
| if (!auth) { | ||
| return ( | ||
| <div {...(isReply ? { id: 'reply' } : {})} className={cn({type: 'alert'})}> | ||
| <Link to={link} state={{back: backLink, replyTo: id}}>{t('comment.authHint.link')}</Link>{t('comment.authHint.text')} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| return ( | ||
| <div {...(isReply ? { id: 'reply' } : {})} className={cn(isReply ? { type: 'reply' } : {})}> | ||
| <label htmlFor="comment">{label}</label> | ||
| <textarea id="comment" | ||
| name="comment" | ||
| onChange={onChangeHandler} | ||
| value={value}/> | ||
| <div className={cn('controls')}> | ||
| <Button title={t('comment.send')} | ||
| disabled={!value.trim()} | ||
| style={'primary'} | ||
| onClick={() => { onAdd(); cancel(); }}/> | ||
| {isReply && <Button title={t('comment.cancel')} style={'outline'} onClick={cancel}/>} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| CommentAction.propTypes = { | ||
| onAdd: PropTypes.func, | ||
| t: PropTypes.func, | ||
| id: PropTypes.string, | ||
| value: PropTypes.string, | ||
| isReply: PropTypes.bool, | ||
| auth: PropTypes.bool, | ||
| link: PropTypes.string, | ||
| backLink: PropTypes.string, | ||
| cancel: PropTypes.func, | ||
| }; | ||
|
|
||
| export default memo(CommentAction); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Передаю локаль, что бы можно было отображать товар в корзине в зависимости от выбранного языка