Skip to content
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

feat: add comment-placer-component #5

Merged
merged 7 commits into from
Feb 21, 2019
Merged

Conversation

PedroMiguelSS
Copy link
Contributor

This PR adds CommentPlacer component. The main goal of this component is to sync animations, scroll and automatic focus that may happen simultaneously.

It handles entry animations for comments. We have currently 2 different animations: FadeAndGrow and Fade. They are used in different cases: FadeAndGrow is applied whether a new comment or a reply textarea enters on the list.
Fade is used when an edit textarea appears.

Sync flows

  • A comment enters the list -> FadeAndGrow entry animation occurs (if the comment will be visible) -> scroll to new comment (if I'm the author of the comment)
  • Reply button clicked -> FadeAndGrow entry animation occurs (if the textarea will be visible) -> scroll to the element occurs -> automatic focus happens
  • Edit button clicked -> Fade entry animation occurs to make textarea visible -> automatic focus happens
  • Save button clicked on new reply -> focus is disabled -> Fade exiting animation occurs to unmount textarea and make the new comment visible.
  • Cancel button clicked on new reply -> focus is disabled -> FadeAndGrow exiting animation occurs.
  • Save button clicked on edit comment -> focus is disabled -> Fade exiting animation occurs to unmount textarea and make the old comment visible.
  • Cancel button clicked on edit comment -> focus is disabled -> Fade exiting animation occurs to unmount textarea and make the edited comment visible.

This component also takes care of another animation: scale comments when they come into view (while users are scrolling the list). Kind of a skew effect.

Other components on this PR

  • FadeAndGrowTransition
  • FadeTransition
  • FocusManager

Copy link
Contributor

@satazor satazor left a comment

Choose a reason for hiding this comment

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

I also think we are missing a README.md file and storybook entry for the CommentPlacer.

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/comment-input/CommentInput.js Outdated Show resolved Hide resolved
src/components/comment-placer/CommentPlacer.js Outdated Show resolved Hide resolved
src/components/comment-placer/CommentPlacer.js Outdated Show resolved Hide resolved
src/components/textarea-autosize/TextareaAutosize.js Outdated Show resolved Hide resolved
@satazor satazor force-pushed the feat/comment-placer-component branch from 9fa1521 to 22f1c01 Compare February 21, 2019 17:32
@satazor satazor force-pushed the feat/comment-placer-component branch from 22f1c01 to e921613 Compare February 21, 2019 17:34
@satazor
Copy link
Contributor

satazor commented Feb 21, 2019

There's a bug in the textarea height animation in some situations but @acostalima will take care of it later on.

@satazor satazor merged commit dfe61d3 into master Feb 21, 2019
@satazor satazor deleted the feat/comment-placer-component branch February 21, 2019 17:36
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.

2 participants