forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] Fade Component, replaces FadeMixin
- Loading branch information
Showing
11 changed files
with
358 additions
and
79 deletions.
There are no files selected for viewing
This file contains 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,29 @@ | ||
|
||
class Example extends React.Component { | ||
|
||
constructor(...args){ | ||
super(...args); | ||
this.state = {}; | ||
} | ||
|
||
render(){ | ||
|
||
return ( | ||
<div> | ||
<Button onClick={()=> this.setState({ open: !this.state.open })}> | ||
click | ||
</Button> | ||
<Fade in={this.state.open}> | ||
<div> | ||
<Well> | ||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. | ||
Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. | ||
</Well> | ||
</div> | ||
</Fade> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
React.render(<Example/>, mountNode); |
This file contains 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,90 @@ | ||
'use strict'; | ||
import React from 'react'; | ||
import Transition from './Transition'; | ||
|
||
class Fade extends React.Component { | ||
|
||
constructor(props, context){ | ||
super(props, context); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Transition | ||
{...this.props} | ||
in={this.props.in} | ||
className='fade' | ||
enteredClassName='in' | ||
enteringClassName='in' | ||
> | ||
{ this.props.children } | ||
</Transition> | ||
); | ||
} | ||
} | ||
|
||
Fade.propTypes = { | ||
/** | ||
* Fade the Component in or out. | ||
*/ | ||
in: React.PropTypes.bool, | ||
|
||
/** | ||
* Provide the durration of the animation in milliseconds, used to ensure that finishing callbacks are fired even if the | ||
* original browser transition end events are canceled. | ||
*/ | ||
duration: React.PropTypes.number, | ||
|
||
/** | ||
* A Callback fired before the component starts to fade in. | ||
*/ | ||
onEnter: React.PropTypes.func, | ||
|
||
/** | ||
* A Callback fired immediately after the component has started to faded in. | ||
*/ | ||
onEntering: React.PropTypes.func, | ||
|
||
/** | ||
* A Callback fired after the component has faded in. | ||
*/ | ||
onEntered: React.PropTypes.func, | ||
|
||
/** | ||
* A Callback fired before the component starts to fade out. | ||
*/ | ||
onExit: React.PropTypes.func, | ||
|
||
/** | ||
* A Callback fired immediately after the component has started to faded out. | ||
*/ | ||
onExiting: React.PropTypes.func, | ||
|
||
/** | ||
* A Callback fired after the component has faded out. | ||
*/ | ||
onExited: React.PropTypes.func, | ||
|
||
|
||
/** | ||
* Specify whether the transitioning component should be unmounted (removed from the DOM) once the exit animation finishes. | ||
*/ | ||
unmountOnExit: React.PropTypes.bool, | ||
|
||
/** | ||
* Specify whether the component should fade in or out when it mounts. | ||
*/ | ||
transitionAppear: React.PropTypes.bool | ||
|
||
}; | ||
|
||
Fade.defaultProps = { | ||
in: false, | ||
duration: 300, | ||
dimension: 'height', | ||
transitionAppear: false, | ||
unmountOnExit: false | ||
}; | ||
|
||
export default Fade; | ||
|
This file contains 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 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
Oops, something went wrong.