Skip to content

Instantly share code, notes, and snippets.

@zinary
Created July 25, 2020 09:40
Show Gist options
  • Save zinary/7653cda44712da4ab5497322e5b722ee to your computer and use it in GitHub Desktop.
Save zinary/7653cda44712da4ab5497322e5b722ee to your computer and use it in GitHub Desktop.
Challenge 3 - Intro to Vue
<div class="nav-bar"></div>
<div id="app">
<div class="product">
<div class="product-image">
<img :src="image" />
</div>
<div class="product-info">
<h1>{{ product }}</h1>
<p v-if="inStock">In Stock</p>
<p v-else>Out of Stock</p>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.13/dist/vue.js"></script>
//Add an onSale property to the data, and use it to conditionally render a span that says “On Sale!”
var app = new Vue({
el: '#app',
data: {
product: 'Socks',
image: 'https://www.vuemastery.com/images/challenges/vmSocks-green-onWhite.jpg',
inStock: true
}
})
body {
font-family: tahoma;
color: #282828;
margin: 0px;
}
.nav-bar {
background: linear-gradient(-90deg, #84CF6A, #16C0B0);
height: 60px;
margin-bottom: 15px;
}
.product {
display: flex;
}
img {
border: 1px solid #d8d8d8;
width: 70%;
margin: 40px;
box-shadow: 0px .5px 1px #d8d8d8;
}
.product-image {
flex-basis: 700px;
}
.product-info {
margin-top: 10px;
flex-basis: 500px;
}
.color-box {
width: 40px;
height: 40px;
margin-top: 5px;
}
.cart {
margin-right: 25px;
float: right;
border: 1px solid #d8d8d8;
padding: 5px 20px;
}
button {
margin-top: 30px;
border: none;
background-color: #1E95EA;
color: white;
height: 40px;
width: 100px;
font-size: 14px;
}
.disabledButton {
background-color: #d8d8d8;
}
.review-form {
width: 30%;
padding: 20px;
border: 1px solid #d8d8d8;
}
input {
width: 100%;
height: 25px;
margin-bottom: 20px;
}
textarea {
width: 100%;
height: 60px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment