SJammy
9/21/2019 - 2:30 PM

Handlebars.js Framework - Musicon Shop

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Musicon</title>
    <link rel="stylesheet" type='text/css' href='./style.css'>
    <script src="handlebars.min.js"></script>
    <script id='templateHB' type='text/x-handlebars-template'>
    	<h1>{{title}}</h1>
      <p>{{body}}</p>
      <a href='store.html'>Shop Now</a>
    </script>
  </head>

  <body>
    <header>
      <section class="container">
        <h1 class="branding">Musicon</h1>

        <nav>
          <ul class='navbar'>
          	<li class='current'><a href='index.html'>Home</a></li>
            <li ><a href='store.html'>Store</a></li>
            <li ><a href='contact.html'>Contact</a></li>
          </ul>
        </nav>

      </section>
    </header>

    <article id="introduction">
      <section id='information' class="container">
        
     </section>
    </article>

    <footer>
      <p>&copy; Musicon</p>
    </footer>
    <script src="./main.js"></script>
  </body>
</html>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Musicon</title>
    <link rel="stylesheet" type='text/css' href='./style.css'>
    <script src="handlebars.min.js"></script>
    <script id='templateHB' type='text/x-handlebars-template'>
    	{{#each instruments}}
        <article class="instrument">
      		<img class="image" src="{{this.image}}" alt="{{this.name}}">
          <section class="details">
            <h2 class="name">"{{this.name}}"</h2>
            <p class="description">"{{this.description}}"</p>
            {{#if this.sale}}
            	<p class="price"><del>"Price: {{this.price}}"</del></p>
              <p class="sale">"On Sale! {{this.sale}}"</p>
              <p class="deal">"With Deal: {{this.deal}}"</p>
            {{else}} 
              <p class="price">"Price: {{this.price}}"</p>
            {{/if}} 
            
          </section>
        </article>
      {{/each}}
    </script>
    
  </head>

  <body>
    <header>
      <section class="container">
        <h1 class="branding">Musicon</h1>

        <nav>
          <ul class='navbar'>
          	<li ><a href='index.html'>Home</a></li>
            <li class='current'><a href='store.html'>Store</a></li>
            <li ><a href='contact.html'>Contact</a></li>
          </ul>
        </nav>
      </section>
    </header>

    <article id="showcase">
      <section id='information' class="container">
        

      </section>
    </article>

    <footer>
      <p>&copy; Musicon 2018</p>
    </footer>

    <script src="./main.js"></script>
  </body>
</html>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Musicon</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type='text/css' href='style.css'>
  </head>

  <body>
    <header>
      <section class="container">
        <h1 class="branding">Musicon</h1>

        <nav>
          <ul class='navbar'>
          	<li ><a href='index.html'>Home</a></li>
            <li ><a href='store.html'>Store</a></li>
            <li class='current'><a href='contact.html'>Contact</a></li>
          </ul>
        </nav>

      </section>
    </header>

    <article id="connection">
      <section id="top">
        <h2>Let's Get In Touch!</h2>
        <p>Ready to start purchasing your musical instruments on Musicon? That's great! Give us a call or send us an email and we will get back to you as soon as possible!</p>
      </section>

      <section class="contact">
        <img class="icon" src="https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/phone+icon.svg" alt="phone icon">
        <p>123-456-7890</p>
      </section>

      <section class="contact">
        <img src="https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/mail+icon.svg" alt="email icon">
        <p>feedback@musicon.com</p>
      </section>

      <section class="contact">
        <img src="https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/location+icon.svg" alt="location pin icon">
        <ul id="location">
          <li>Musicon</li>
          <li>111 Music Rd, Suite 33</li>
          <li>New York, NY 11111</li>
        </ul>
      </section>
    </article>

    <footer>
      <p>&copy; Musicon 2018</p>
    </footer>
  </body>
</html>
const context = {
  title: 'Welcome to Musicon',
  body: 'Musicon is a budding musical storefront with a mission to share the joy of music. These magnificent auditory tools are designed with musical creators, like you, in mind. Hobbyists, beginners, and experts alike can appreciate the resplendent sounds supplied by each and every instrument we carry. Join us in delivering the euphoric vibrations of melodia to the citizens of the world!',
  instruments: [
    {
      image: 'https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/electronic-keyboard.png',
      name: 'Electronic Keyboard',
      description: 'A piano welcomed to the 21th century. Pianists celebrate the compact form factor and the diversity of synthesized rhythms all in one masterful musical machine.',
      price: '$1,999.00',
      sale: '$1,699.89'
    },
    {
      image: 'https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/electric-guitar.png',
      name: 'Electric Guitar',
      description: 'Join the legends of the \'50s and \'60s when the marriage of guitar and electricity created the most influential instrument of a generation. Note: picks sold separately.',
      price: '$599.99'
    },
    {
      image: 'https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/bass-guitar.png',
      name: 'Bass Guitar',
      description: 'Experience the embodiment of funkadelic frequencies that is the bass guitar. Let the deep low notes of the bass guitar resonate with heartbeats everywhere.',
      price: '$624.99'
    },
    {
      image: 'https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/drum-kit.png',
      name: 'Drum Kit',
      description: 'Ever thought, "one instrument isn\'t enough?" Find an answer in the drum kit. Coordinate a collections of drums and cymbals to dictate the rhythm of musical masterpiece.',
      price: '$649.00',
      sale: '$349.00'
    },
    {
      image: 'https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/violin.png',
      name: 'Violin',
      description: 'A versatile that is suited for any and all occasions. Those wearing tuxedos can strum together a classic. Others who prefer overalls can call it a fiddle and play some folk songs.',
      price: '$245.00'
    }
  ]
};

const templateElement = document.getElementById('templateHB');

const templateSource  = templateElement.innerHTML;

const template = Handlebars.compile(templateSource);

const compiledHtml = template(context);

document.getElementById('information').innerHTML = compiledHtml;
/* General Rulesets */
* {
  color: #ffffff;
}

body {
  font-family: Helvetica, sans-serif;
	background: url("https://s3.amazonaws.com/codecademy-content/courses/learn-handlebars/musicon/musicon_bg.png") no-repeat center center fixed;
  background-size: cover;
}

a {
  text-decoration: none;
}

footer {
  width: 100%;
  text-align: center;
  bottom: 0;
  position: static;
}

header {
  padding-top: 3%;
  min-height: 70px;
}

.container {
	width: 90%;
  margin: auto;
}

.branding {
  float: left;
}

.branding h1 {
  font-weight: normal;
}

nav {
  float: right;
}

.navbar {
  margin-top: 15%;
}

.navbar li {
  display: inline-block;
  padding: 0 5px;
}

.navbar li a {
  color: rgba(255, 255, 255, 0.8);
  font-weight: normal;
}

.navbar li a:hover, .navbar .current a {
  color: #ffffff;
}

/* Home Page Rulesets */

#introduction {
	text-align: center;
  margin-top: 15%;
  margin-bottom: 50%;
}

#introduction h1 {
  font-size: 60px;
}

#introduction p {
  margin: 10% auto;
  font-size: 18px;
  font-weight: lighter;
}

#introduction a {
  display: block;
  width: 20%;
  padding: 3% 8%;
  margin: 0 auto;
  color: #ffffff;
  background-color: #4c7ef3;
  border-radius: 4px;
}

#introduction a:hover {
  background-color: #26A69A;
}

/* Store Page Rulesets */

#showcase {
  margin-top: 5%;
  margin-bottom: 15%;
}

.instrument {
  width: 90%;
  overflow: auto;
	background-color: white;
  opacity: 0.9;
  padding: 2% 5%;
  margin: 5% auto;
  border-radius: 5px;
}

.image {
  display: inline-block;
  vertical-align: middle;
  width: 32%;
  min-width: 100px;
  margin: 0 auto;
}

.details {
  display: inline-block;
  vertical-align: middle;
  width: 60%;
  margin: -1% auto;
  padding: 2%;
}

.name, .description, .price, del {
  color: #000000;
  text-align: left;
}

.description, .price {
  margin-top: 0;
  margin-bottom: 16px;
}

.description {
  height: 100%;
  font-size: 13px;
  overflow: auto;
}

.price {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
}

.sale {
  margin-top: 0;
  margin-bottom: 0;
  color: #fa4359;
  font-size: 16px;
  font-weight: bold;
  text-align: left;
}

/* Contact Page Rulesets */

#connection {
  width: 100%;
  margin: 15% auto;
  text-align: center;
}

#top {
  margin: 15% auto;
}

#top h2 {
  margin: 3%
  font-size: 30px;
  font-weight: normal;
}

#top p {
  margin: 3%
  font-size: 18px;
  font-weight: lighter;
}

.contact {
  width: 100%;
  margin: 10% auto;
}

.contact p, .contact ul {
  margin: 1%;
  font-size: 16px;
  font-weight: lighter;
}

#location {
  margin: 0;
  padding: 0;
  list-style-type: none;
}