123

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

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

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">


<div id="app"></div>

            
          
!
            
              
#text {
  font-size: 30px;
  position: relative;
  top: 10px;
  left: 10px;
  width: 580px;
  font-family: Bodoni;
}
.cool {
  animation-name: fadeout;
  animation-duration: 2s;
}
@keyframes fadeout {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}


#author {
  position: relative;
  top: 10px;
  left: 10px;
  font-family: Bodoni;
  font-size: 20px;
  
}

#quote-box {
  background-color: #e6e6e6;
  height: 320px;
  width: 600px;
  margin: auto;
  position: relative;
  top: 270px;
  border-radius: 7px;
  border: 1px solid black;
  margin-bottom: 400px;
}

.fa-twitter {
  background: #55ACEE;
  color: white;
  height: 18%;
  width: 13%
}

.fa {
  padding: 13px;
  border-color: #55ACEE; 
  border-radius: 3px;
  position: absolute;
  left: 20px;
  top: 250px;
  }
.fa:hover{
  color: yellow;
  background-color: #75bbf0;
  border-color: #75bbf0;
}

  #new-quote {
    padding: 4px;
    background: #55ACEE; 
    color: white;
    border-color: #55ACEE; 
    border-radius: 3px;
    position: absolute;
    left: 455px;
    right: 8px;
    top: 250px;
    height: 18%;
    width: 21%;
    font-family: Bodoni;
  }
#new-quote:hover{
  color: yellow;
  background-color: #75bbf0;
  border-color: #75bbf0;
}
#navbar a:hover {
  color: black;
}





#wab {
  display: none;
}
#navbar a {
  color: gray;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 20px;
  margin: auto;
}
#navbar {
  text-align: center;
  overflow: hidden;
  font-family: Bodoni;
  border-bottom: 1px solid black;
}

#summary-container {
  display: flex;
  justify-content: center;
}


#summary {
  width: 70vw;
  font-family: Bodoni;
  font-size: 16px;
  position: relative;
  top: 15px;
}

#gma {
  max-width: 100%;
  display: block;
  height: auto;
}
.castDescription, #cast-header, #quotes-header {
  text-align: center;
  font-family: Bodoni;
  font-size: 20px;
}
#cast-header {
  font-size: 30px;
}
#quotes-header {
  position: relative;
  top: 260px;
  font-size: 30px;
}
#BobWileyImg, #DrMarvinImg, #FeyImg, #SiggyImg, #AnnaImg, #MrGutmanImg, #MrsGutmanImg {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
#movie-title {
  display: inline;
  font-style: italic;
  font-weight: bold;
}
.sticky {
  position: fixed;
  top: 0;
  width: 100%;
}
.sticky + #body {
  padding-top: 60px;
}
            
          
!
            
              
class App extends React.Component{
  constructor(props) {
    super(props);
    this.state = {
      
    }
  }
    render() {
      return(
      <div>
          <Quotes />
      </div>
      )
    }
  }


class Quotes extends React.Component{
  constructor(props) {
    super(props);
    this.state = {
      randomIndex: ''
    }
    this.generateIndex = this.generateIndex.bind(this);
    this.tweetQuote = this.tweetQuote.bind(this);
    this.loadQuote = this.loadQuote.bind(this);
    }
    componentDidMount(){
      this.loadQuote()
    }
    loadQuote() {
      this.setState({
       randomIndex: Math.floor(Math.random() * 14) 
      })
    }
    generateIndex() {
      this.generateAnimation();
    setTimeout(() => 
      this.setState({
      randomIndex: Math.floor(Math.random() * 14)
    }), 1000)  
  }
  generateAnimation() {
    document.getElementById('text').setAttribute('class','cool');
     document.getElementById('author').setAttribute('class','cool');
 setTimeout(() => document.getElementById('text').removeAttribute('class','cool'), 1000) 
 setTimeout(() => document.getElementById('author').removeAttribute('class','cool'), 1000) 
  }
  
  tweetQuote(){
     const quoteBank = [
  "You understand, don't you? There's no other solution. You won't go away.",
  "I'm on vacation!! This isn't an appointment, I'm stopping by!",
  "It'll probably be just a short interview anyway. Just me and the family, and...my book.",
  "So you're saying, I didn't leave my wife because she liked Neal Diamond but maybe...maybe she left me?",
  "If I fake it, then I don't have it.",
  "Oh, Fay, this is so scrumptious. Is this hand-shucked?",
  "Have a great vacation family!...me too.",
  "Dr. Marvin, how's the weather up there? How's your brood? Y'all gettin' a chance to relax?",
  "The book is 'Baby Steps'. The author is Dr. Leo Marvin. And we've been talking with Bob Wiley...pretty impressive stuff Bob.",
  "Getouttathecahhhhhhh",
  "Ohh the fish.",
  "That was in my office. In my home, I'd like you to call me Dr. Marvin.",
  "It's just kids being kids.",
    "Dr. Marvin, guess what? Ahoy, I sail, I'm a sailor, I sail! "
];

const quoteAuthors = [
 "Dr. Leo Marvin", "Bob Wiley", "Dr. Leo Marvin", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Marie", "Dr. Leo Marvin", "Dr. Leo Marvin", "Fay Marvin", "Bob Wiley"
]

const quote = quoteBank[this.state.randomIndex];

const author = quoteAuthors[this.state.randomIndex];
    document.getElementById('tweet-quote').setAttribute("href",`https://twitter.com/intent/tweet?text=${quote}`)
  }
  
  handleScroll() {
    var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
    if (window.pageYOffset >= sticky) {
    navbar.classList.add("sticky")
  } else {
    navbar.classList.remove("sticky");
  }
  }
  render() { 
    window.onscroll = this.myFunction;
    
    const quoteBank = [
  "You understand, don't you? There's no other solution. You won't go away.",
  "I'm on vacation!! This isn't an appointment, I'm stopping by!",
  "It'll probably be just a short interview anyway. Just me and the family, and...my book.",
  "So you're saying, I didn't leave my wife because she liked Neal Diamond but maybe...maybe she left me?",
  "If I fake it, then I don't have it.",
  "Oh, Fay, this is so scrumptious. Is this hand-shucked?",
  "Have a great vacation family!...me too.",
  "Dr. Marvin, how's the weather up there? How's your brood? Y'all gettin' a chance to relax?",
  "The book is 'Baby Steps'. The author is Dr. Leo Marvin. And we've been talking with Bob Wiley...pretty impressive stuff Bob.",
  "Getouttathecahhhhhhh",
  "Ohh the fish.",
  "That was in my office. In my home, I'd like you to call me Dr. Marvin.",
  "It's just kids being kids.",
   "Dr. Marvin, guess what? Ahoy, I sail, I'm a sailor, I sail! "
];

const quoteAuthors = [
 "Dr. Leo Marvin", "Bob Wiley", "Dr. Leo Marvin", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Bob Wiley", "Marie", "Dr. Leo Marvin", "Dr. Leo Marvin", "Dr. Leo Marvin", "Fay Marvin", "Bob Wiley"
]

const quote = quoteBank[this.state.randomIndex];

const author = quoteAuthors[this.state.randomIndex];
    return (
      <body id="body">
        <Navbar onScroll={this.handleScroll} />
        <img id="gma" src="https://musicart.xboxlive.com/6/cfbcf4ed-0000-0000-0000-000000000009/504/image.jpg?w=1920&h=1080"/>
        <Summary />
        <Cast />
        <h3 id="quotes-header">Best lines! (any from the movie)</h3>
      <div id="quote-box">
      <p id="text" class="quote-author">{quote}</p>
      <p id="author" class="quote-author">- {author}</p>
        <br /><br /><br />
      <a class ="twitter-share-button" target="_blank" href="https://twitter.com/intent/tweet" id="tweet-quote" onClick={this.tweetQuote}><button class="fa fa-twitter"></button></a>
      <button id="new-quote" onClick={this.generateIndex}>New Quote</button> 
      </div>
        </body>
    );
  }
}

class Navbar extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      
    }
  }
  render() {
    return(
    <div>
        <div id="navbar">
          <a href="#navbar">Home</a>
          <a href="#cast-container">Cast</a>
          <a href="#quote-box">Quotes!</a>
          <a href="#summary">About</a>
        </div>
    </div>
    )
  }
}

class Summary extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      
    }
  }
  render() {
    return(
    <div id="summary-container">
        <p id="summary"><p id="movie-title">What About Bob?</p> is a 1991 comedy directed by Frank Oz, starring Bill Murray and Richard Dreyfuss. Murray plays Bob Wiley, an irritating patient who follows his egotistical psychiatrist Dr. Leo Marvin (Dreyfuss) on vacation. When the unstable Bob befriends the other members of Marvin's family, it pushes the doctor over the edge.

The film is considered the funniest of all time by anyone with a good sense of humor.</p>
    </div>
    )
  }
}


class Cast extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      
    }
  }
  render() {
    return(
    <div id="cast-container">
          <h3 id="cast-header">Cast</h3>
          <p class="castDescription">Bill Murray as Bob Wiley</p>
          <img id="BobWileyImg" src="http://www.brostrick.com/wp-content/uploads/2017/10/sailing2.jpg" alt="Bill Murray as Bob Wiley" width="263.5" height="169.5"/>
          <p class="castDescription">Richard Dreyfus as Dr. Leo Marvin</p>
          <img id="DrMarvinImg" src="https://vignette.wikia.nocookie.net/villains/images/f/f1/Dr._Leo_Marvin.jpg/revision/latest?cb=20130714173308" alt="Richard Dreyfus as Leo Marvin" width="150" height="223" />
          <p class="castDescription">Julie Hagerty as Fey Marvin</p>
          <img id="FeyImg" src="https://m.media-amazon.com/images/M/MV5BNWIwMWU2YzktOWJlNy00Y2VhLWEzM2UtMTNmZThmOTA5ZDU5XkEyXkFqcGdeQXVyMzMyODMwMTI@._V1_.jpg" alt="Julie Hagerty as Fey Marvin" width="300" height="168.5"/>
          <p class="castDescription">Charlie Korsmo as Sigmund "Siggy" Marvin</p>
          <img id="SiggyImg"src="https://i.ytimg.com/vi/F5ZSyAuNMCM/hqdefault.jpg" alt="Charlie Korsmo as Simund Marvin" width="240" height="180"/>
          <p class="castDescription">Kathryn Erbe as Anna Marvin</p>
          <img id="AnnaImg"src="https://moviereviewtheblog.files.wordpress.com/2014/04/bangs2.jpg" alt="Kathryn Erbe as Anna Marvin" width="306.5" height="189.5" />
          <p class="castDescription">Tom Aldredge as Mr. Guttman</p>
          <img id="MrGutmanImg"src="https://i.ytimg.com/vi/nb1b5DZ3LtY/hqdefault.jpg" alt="Tom Aldredge as Mr.Guttman" width="240" height="180" />
          <p class="castDescription">Susan Willis as Mrs. Guttman</p>
          <img id="MrsGutmanImg"src="https://i.ytimg.com/vi/yLfpAPAZP30/maxresdefault.jpg" alt="Susan Willis as Mrs. Guttman" width="320" height="180" />
        
    </div>
    )
  }
}

ReactDOM.render(<App />, document.getElementById('app'));
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console