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(Transition): add component #1435

Merged
merged 16 commits into from Jul 26, 2017
Merged

feat(Transition): add component #1435

merged 16 commits into from Jul 26, 2017

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Mar 10, 2017

Fixes #200.

This PR is second try for Transition component. It uses react-addons-transition-group for deal with SUI's CSS animations.

@levithomason
Copy link
Member

❤️

@layershifter
Copy link
Member Author

layershifter commented Mar 25, 2017

Main problem that I have there it's missing cancelUnmount event. So when component is unmouting there is no way to know that we need to cancel unmount animation if component changed state and is visible again.

I need to pull transition-group code and review it, possible I'm missing something.

@bjmiller
Copy link

bjmiller commented Apr 10, 2017

Is there anything we can do to help get this completed and merged? My team is excited to have transitions.

@layershifter
Copy link
Member Author

@bjmiller Thanks for ping. This PR is one of the most complicated places, it needs enough time to find the best solution, since this is not my first attempt to solve it 😄

I hope to find enough time on this weekend to create MVP which meets all the requirements

@layershifter
Copy link
Member Author

layershifter commented Apr 17, 2017

I've pulled code from react-transition-group#24 as start point. I will try to spend all free time to finish it.

TODO

  • combile Transition and TransitionWrapper;
  • wrap all children automatically on TransitionGroup
  • remove dependency on dom-helpers
  • replace original callbacks with callbacks that more closer to SUI
  • make an inventory in propTypes
  • typings
  • docs and tests
  • refactor mergeChildMappings

@codecov-io
Copy link

codecov-io commented Apr 20, 2017

Codecov Report

Merging #1435 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1435      +/-   ##
==========================================
+ Coverage   99.75%   99.76%   +<.01%     
==========================================
  Files         145      147       +2     
  Lines        2477     2577     +100     
==========================================
+ Hits         2471     2571     +100     
  Misses          6        6
Impacted Files Coverage Δ
src/modules/Transition/TransitionGroup.js 100% <100%> (ø)
src/modules/Transition/Transition.js 100% <100%> (ø)
src/collections/Form/Form.js 100% <0%> (ø) ⬆️
src/elements/Input/Input.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c96363c...97f77a9. Read the comment docs.

@layershifter layershifter force-pushed the feat/transition-2 branch 2 times, most recently from 0da3649 to 9f6c1dd Compare May 26, 2017 13:30
@layershifter layershifter force-pushed the feat/transition-2 branch 3 times, most recently from e7c5625 to 19a988f Compare June 7, 2017 11:26
Copy link
Member Author

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@levithomason I'm finally ready to say that we are ready to review 🎉

To all: this component is ready for some user testing and feedback.

How?

If you could pull this branch feat/transition-2, npm install, npm start, and navigate to http://localhost:8080/modules/transition, you'll see the Transition component examples. Please have a look at the code, play with the editors, and let me know what you think.

@brianespinosa
Copy link
Member

Sweet! I will get some testing in on this branch this weekend. Great work @layershifter. I was sad when the old version had to be abandoned, but I am glad we are using the non-deprecated package that React team is supporting with this one.

@john-osullivan
Copy link

john-osullivan commented Jul 8, 2017

Just wanted to drop by and say that y'all are MVPs for going through the legwork of porting Semantic-UI. Particularly here when it gets really messy, hooking into React's animation systems. I've been using React for years and that stuff still mystifies me. Thanks for working on this! I'll try to test it if my team finishes required UI soon, and if not, I look forward to using it once it's merged. Thank you for contributing to OSS ❤️

<Transition.Group
as={List}
duration={1000}
divided size='huge'
Copy link
Member

Choose a reason for hiding this comment

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

Whoops, two lines: divided size='huge'

/** Primary content. */
children?: React.ReactNode;

/** Duration of the CSS transition animation in microseconds. */
Copy link
Member

Choose a reason for hiding this comment

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

microseconds => milliseconds

/** Primary content. */
children: PropTypes.node,

/** Duration of the CSS transition animation in microseconds. */
Copy link
Member

Choose a reason for hiding this comment

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

microseconds => milliseconds

/** Primary content. */
children?: React.ReactNode;

/** Duration of the CSS transition animation in microseconds. */
Copy link
Member

Choose a reason for hiding this comment

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

microseconds => milliseconds

/** Primary content. */
children: PropTypes.node,

/** Duration of the CSS transition animation in microseconds. */
Copy link
Member

Choose a reason for hiding this comment

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

microseconds => milliseconds

@levithomason
Copy link
Member

Heads up, I'm going to push some refactors and updates here for a bit.

@levithomason levithomason force-pushed the feat/transition-2 branch 3 times, most recently from cfb5e41 to 925efe2 Compare July 16, 2017 19:34
type='range'
value={duration}
/>
<Form.Button content={visible ? 'Hide' : 'Show'} onClick={this.handleVisibility} />
Copy link
Member

Choose a reason for hiding this comment

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

When changing state during a transition the example does not behave correctly as the transition is interrupted. I'd like to disable the form controls while the transition is in progress.

In trying to disable/enable the Show/Hide button in the explorer examples, I now think we need to fire the callbacks on Transition.Group for each transition as well. I'm not sure there is a way to capture start/complete without this.

Would you mind updating the examples to show how this is possible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, thanks for attracting attention there. I'm that Transition.Group should also have onComplete, onHide, onShow, onStart and this should be illustrated in separate example.

Copy link
Member Author

Choose a reason for hiding this comment

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

However, I want to do this in sepate PR, this one is already big enough.

Copy link
Member

Choose a reason for hiding this comment

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

Separate PR sounds good.

@levithomason
Copy link
Member

This is looking fantastic, thanks! I have a couple questions in addition to what I left inline. It would be great to get your thoughts behind these items:

Transition vs Transition.Group

I'm a little confused on the use of Transition vs Transition.Group. The group seems to be used on single elements when they need to mount/unmount in sync with the transition. The single Transition seems to be used for static transitions. However, in the examples when trying to replace a Transition.Group around a single element with a Transition I cannot seem to figure out how to get it to work.

Intuitively, I would expect a Transtion to only allow a single child and a Transition.Group to accept multiple children. I'd then think a group would handle group operations such as staggering:

https://semantic-ui.com/modules/transition.html#/examples

http://g.recordit.co/VE1nZEHykR.gif

Could you give some info on what the differences are and why two components are needed to accomplish this?

into

Could you expound a bit on this prop? I'm not entirely sure why it is needed and what the intent behind it is.


Again, thanks for the massive amount of work here. We'll surely get this merged soon 🎉

@levithomason
Copy link
Member

levithomason commented Jul 26, 2017

I've pushed some changes here, no changes to the logic, only naming and docs:

  1. rename into -> visible
  2. rename enter/exit/appear terminology to show/hide/mount in keeping with SUI
  3. rename "entire" transitions to "directional" (vs static)
  4. refactored Transition/Transition Group docs to clarify differences and usage
  5. refactored Explorer docs to clarify differences and usage
  6. fixed missing typings

In the next PR(s) let's address:

  • Implementing Transition in our own components
  • Transition.Group callbacks
  • Usage examples for various props (unmountOnHide, etc)

@levithomason levithomason merged commit 049040a into master Jul 26, 2017
@levithomason levithomason deleted the feat/transition-2 branch July 26, 2017 19:43
@bjmiller
Copy link

@levithomason: Is there an ETA for a new release that includes this feature?

@levithomason
Copy link
Member

Released in semantic-ui-react@0.71.3

@levithomason
Copy link
Member

I do the best I can to make a release every weekend.

@rutvijprimaseller
Copy link

Is there a way to animate Accordion or shall we expect it in later releases? @levithomason

@brianespinosa
Copy link
Member

@rutvijprimaseller Currently there is no support for animating in accordions. This Transition component just barely got merged into SUIR and the components in the project have not yet been updated to use it.

@layershifter you might know... are there separate tasks set aside for converting each of these yet?

@layershifter
Copy link
Member Author

No, there are no separate tasks. But, plans for them exist of course. I want begin from Dimmer because it will be used by Modal (#1739). I want finish some of my open PRs and then I will start on it.

@brianespinosa
Copy link
Member

@layershifter That makes my day to hear.

@Maxhodges
Copy link

can I track the status of Accordion transitions somewhere? It's too fast, so I want a slightly slower animation.

@subodhpareek18
Copy link

Is it possible to run static animation transitions in a loop? Like a continuous tada animation on a call icon for an incoming call notification until it's clicked on and picked up.

@Semantic-Org Semantic-Org locked and limited conversation to collaborators Oct 26, 2017
@levithomason
Copy link
Member

@subodhpareek18 I don't see why not

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

Successfully merging this pull request may close these issues.

None yet

9 participants