<!DOCTYPE html>
<html>

  <head>
    <link href="https://fonts.googleapis.com/css?family=Space+Mono:400,700" rel="stylesheet">
    <link rel="stylesheet" href="https://cssgram-cssgram.netdna-ssl.com/cssgram.min.css">
    <link rel="stylesheet" href="style.css">
  </head>

  <body>
    <figure id="image">
      <img src="https://unsplash.it/500/500?image=691">
    </figure>
    
    <div id="buttons">
      <button id="reset">&times; Reset</button>
      <button id="apply">Apply "Moon" Filter</button>
      
      <!-- <p>Does image have "Moon" filter applied? <strong id="check">No</strong></p> -->
    </div>
    
    <script src="script.js"></script>  
  </body>

</html>
let image = document.getElementById('image');
let reset = document.getElementById('reset');
let applyFilter = document.getElementById('apply');

/* Step 1: `add`  */
applyFilter.addEventListener('click', () => {
  // image.classList.add('moon');
  image.classList.add('moon', 'small');
});


/* Step 2: `remove`  */
reset.addEventListener('click', () => {
  image.classList.remove('moon');
  // image.classList.remove('moon', 'small');
});


/* Step 3: `toggle`  */
// After showing add, show toggle
// applyFilter.addEventListener('click', () => {
  // image.classList.toggle('moon');
  // image.classList.toggle('moon', 1 < 2);
// });


/* Step 4: `contains` */
// let updateCheck = () => {
//   let check = document.getElementById('check');
//   check.innerHTML = image.classList.contains('moon') ? 'Yes' : 'No';
// };

/* Apply the `contains` function to `toggle` and `remove` */
// updateCheck();
* {
  box-sizing: border-box;
}

body {
  font-family: 'Space Mono', monospace;
}

button {
  cursor: pointer;
  padding: 0.5rem 1rem;
  border: none;
  outline: 0;
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  color: #F7F7FF;
  background-color: #FE5F55;
  border-radius: 4px;
}

  button:hover {
    background-color: #FF0F00;
  }
  
  button:active {
    position: relative;
    top: 1px;
    background: #EE0E00;
  }


#image {
  margin: 3rem auto;
  width: 500px;
  height: 500px;
  text-align: center;
}
  
  #image.small {
    width: 250px;
    height: 250px;
  }
  
  #image img {
    width: 100%;
    height: 100%;
  }

#buttons {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 500px;
  margin: 0 auto;
}

  #buttons p {
    flex: 100%;
    margin-top: 2rem;
  }

.border {
  border: 5px solid #FE5F55;
}
#Learn how to use the classList API to manipulate the DOM.

Learn how to add, remove and test for CSS classes using the classList API. It's more powerful than using `className` and doesn't require any dependencies.