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

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<div id="wrapper">
<div id="quote-box"></div>
</div>


              
            
!

CSS

              
                body {
   background: url(https://cdn.wallpapersafari.com/17/2/LDtjnz.jpg) no-repeat center center fixed;
   font-family: 'Raleway', sans-serif;
 }



#quote-box {
  color: white;
  text-align: justify; 
  margin: 100px auto;
  width: 500px;
  text-indent: 15px
}

#tweet-button {
 margin: 20px;
}


              
            
!

JS

              
                 const quotes = [
  {quote: "Looking at the earth from afar you realize it is too small for conflict and just big enough for co-operation.",
  author: "Gagarin"}, 
  {quote:"Nothing will stop us. The road to the stars is steep and dangerous. But we're not afraid . . . Space flights can't be stopped. This isn't the work of one man or even a group of men. It is a historical process which mankind is carrying out in accordance with the natural laws of human development.",
  author: "Gagarin"}, 
   {quote:"The Earth is blue... how wonderful. It is amazing",
   author: "Gagarin"},
 {quote: "The universe is a pretty big place. If it’s just us, seems like an awful waste of space.",
  author: "Carl Sagan"},
 {quote: "When I first looked back at the Earth, standing on the Moon, I cried.",
  author: "Alan Shepard"},
 {quote: "Contact light.",
  author: "Buzz Aldrin"},
   {quote: "A bird cannot fly with one wing only. Human space flight cannot develop any further without the active participation of women.",
    author: "Valentina Tereshkova"
}
 ];

class MyReactElement extends React.Component {
  constructor(props) {
    super(props); {
      this.state = {
        quote: "The Earth is blue... how wonderful. It is amazing",
        author: " - Gagarin"
      }
      this.nextQuote = this.nextQuote.bind(this)
    }
  }
  
  nextQuote() {
    
    
  const getRandomArbitrary = Math.floor(Math.random() * 7)
    this.setState({
     quote: quotes[getRandomArbitrary].quote,
      author: quotes[getRandomArbitrary].author,
    });
     
  }
 
  render() {
    return(
      <section id="myReactComponent">
        <div id="text"><h5 >{this.state.quote}</h5></div>
        <div id="author">{this.state.author}</div>
        <button onClick={this.nextQuote} type="button" id="new-quote" class="btn btn-primary btn-md">Next quote<i class="fa fa-arrow-right"></i></button>
        <button type="button"  id="tweet-button" class="btn btn-primary btn-md"><a id="tweet-quote" href="twitter.com/intent/tweet"></a><i class="fa fa-twitter"></i></button>
      </section>
      );
  }
}
ReactDOM.render(<MyReactElement />, document.getElementById("quote-box"));



              
            
!
999px

Console