Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id ="wrap">
  </div>





              
            
!

CSS

              
                
.text{
  display : block;
  position : relative;
  background : maroon;
  //text-align : center;
  margin : auto;
  font-size: 20px;
  height : 70px;
}
.fade-enter{
  transform : translateY(-200px);
}
.fade-enter-active{
  transform : translateY(0px);
  transition: 1s ease-in all;
}
.fade-leave{
  opacity : 1;
}
.fade-leave-active{
  opacity : 0;
  transition : 1s ease-out all;
}
              
            
!

JS

              
                const ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
const quotes = [{
	quote : "I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can\'t handle me at my worst, then you sure as hell don\'t deserve me at my best.",
author : 'Marilyn Monroe',
	style : {background : '#16a085', color : '#16a085'},
	buttonStyle : {background : '#16a085', color : 'white'}
},
{
	quote : "“It is our choices, Harry, that show what we truly are, far more than our abilities.”",
	author : "J.K. Rowling",
	style : {background : '#27ae60', color : '#27ae60'},
	buttonStyle : {background : '#27ae60', color : 'white'}
},
{
	quote : "You've gotta dance like there's nobody watching,Love like you'll never be hurt, Sing like there's nobody listening, And live like it's heaven on earth.",
	author : "William M Purkey",
	style : {background : '#2c3e50', color : '#2c3e50'},
	buttonStyle : {background : '#2c3e50', color : 'white'}
},
{
	quote : "“Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.”",
	author : "H. Jackson Brown Jr.",
	style : {background : '#342224', color : '#342224'},
	buttonStyle : {background : '#342224', color : 'white'}
},
{
	quote : "“Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. Because the people who are crazy enough to think they can change the world, are the ones who do.”",
	author : "Rob Siltanen",
	style : {background : '#FB6964', color : '#FB6964'},
	buttonStyle : {background : '#FB6964', color : 'white'}
},
{
	quote : "You've gotta dance like there's nobody watching,Love like you'll never be hurt, Sing like there's nobody listening, And live like it's heaven on earth.",
	author : "William M Purkey",
	style : {background : '#9b59b6', color : '#9b59b6'},
	buttonStyle : {background : '#9b59b6', color : 'white'}
},
{
	quote : "“To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.”",
	author : "Ralph Waldo Emerson",
	style : {background : '#e74c3c', color : '#e74c3c'},
	buttonStyle : {background : '#e74c3c', color : 'white'}
},
{
	quote : "“I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.”",
	author : "Maya Angelou",
	style : {background : '#f39c12', color : '#f39c12'},
	buttonStyle : {background : '#f39c12', color : 'white'}
}];

class App extends React.Component{
  constructor(props){
    super(props);
    const indexOnFirstLoad = Math.floor(Math.random()*8);
    this.state = {
      active : false,
      word : quotes[indexOnFirstLoad].quote,
    }
  }
  handle = () => {
    let index = Math.floor(Math.random()*8);
    if(!this.state.active){
      this.setState({
        active : true,
        word : quotes[index].quote,
      });
    }
    else{
      this.setState({
        active : false,
        word : ''
      });
    }
  }
  
  render(){ 
    const key = <div key = {this.state.word}>{this.state.word}</div>
    return(
       <div>
        <button onClick = {this.handle}>ClickME</button>
        
        <div className ="text">
          <ReactCSSTransitionGroup
            transitionName="fade"
            transitionEnterTimeout={1000}
            transitionLeaveTimeout={1000}>
            {/* the text below must come in from left, but it doesn't :(*/ }
            {key}
            </ReactCSSTransitionGroup>
          </div>
        </div>
    );
  }
}
ReactDOM.render(<App/>, document.getElementById("wrap"));
              
            
!
999px

Console