Skip to content

Instantly share code, notes, and snippets.

@vbguard
Created September 22, 2019 16:31
Show Gist options
  • Select an option

  • Save vbguard/15be3b77562dffa3394bfcbde26a406c to your computer and use it in GitHub Desktop.

Select an option

Save vbguard/15be3b77562dffa3394bfcbde26a406c to your computer and use it in GitHub Desktop.
<% if (prods.length > 0) { %>
<div class="grid">
<% for (let product of prods) { %>
<article class="card product-item">
<header class="card__header">
<h1 class="product__title">
<%= product.title %>
</h1>
</header>
<div class="card__image">
<img src="<%= product.imageUrl %>" alt="<%= product.title %>">
</div>
<div class="card__content">
<h2 class="product__price">$
<%= product.price %>
</h2>
<p class="product__description">
<%= product.description %>
</p>
</div>
<div class="card__actions">
<a href="/products/<%= product._id %>" class="btn">Details</a>
<% if (isAuthenticated) { %>
<%- include('../includes/add-to-cart.ejs', {product: product}) %>
<% } %>
</div>
</article>
<% } %>
</div>
<% } else { %>
<h1>No Products Found!</h1>
<% } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment