Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"no-console": 1,
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"quotes": ["error", "double", { "allowTemplateLiterals": true }],
"func-names": 0,
"space-unary-ops": 2,
"space-in-parens": "error",
Expand Down
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"singleQuote": false
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# sleepoutside

Deployed to <https://main--statuesque-belekoy-5df334.netlify.app>

## Description

Use this as a starting point to complete the WDD 330 team activity: the SleepOutside web application. It scaffolds out a simple web app with Vite support to bundle up our assets.
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"lint": "eslint *.js src/**/*.js",
"format": "prettier --ignore-path ./.gitignore --write \"./**/*.{html,json,js,ts,css}\"",
"test": "jest"

},
"author": "Shane Thompson",
"license": "ISC",
Expand Down
23 changes: 1 addition & 22 deletions src/checkout/index.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Sleep Outside | Checkout</title>

<link rel="stylesheet" href="css/style.css" />

</head>

<body>

<header class="divider">

<div class="logo">

<img src="images/noun_Tent_2517.svg" alt="tent image for logo" />

<a href="index.html">
Sleep
Sleep
<span class="highlight">Outside</span>
</a>

</div>

<div class="cart">

<a href="cart/">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">

<path
d="M18.9 32.6c1.1 2.4 2.5 3.3 5.4 3.3 1.6 0 3.6-0.3 5.9-0.6 3.2-0.5 6.9-1 11.2-1 2.1 0 4.3 0.1 6.4 0.3 2.1 0.1 4.2 0.3 6.1 0.3 3.2 0 5.2-0.4 5.9-1.2 2.7-2.7 2.8-8.8 2.9-14.6 0.1-6.7 0.2-14.5 4.6-18.7 -0.5 0-1 0-1.6 0 -14.2 0-37.5 0-41.1 0C15.6 6.2 14.9 23.6 18.9 32.6z"
/>
Expand All @@ -61,28 +51,17 @@

<!-- <text x="0" y="115" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Natalia Woodroffe</text>
<text x="0" y="120" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text> -->

</svg>

</a>

</div>

</header>

<main class="divider">

<section class="products">

<h2>Review & Place your Order</h2>

</section>

</main>

<footer>&copy;NOT a real business</footer>

</body>

</html>

96 changes: 53 additions & 43 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@
<body>
<header class="divider">
<div class="logo">
<img src="/images/noun_Tent_2517.svg" alt="tent image for logo">
<img src="/images/noun_Tent_2517.svg" alt="tent image for logo" />
<a href="index.html"> Sleep<span class="highlight">Outside</span></a>
</div>
<div class="cart">
<a href="cart/index.html">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M18.9 32.6c1.1 2.4 2.5 3.3 5.4 3.3 1.6 0 3.6-0.3 5.9-0.6 3.2-0.5 6.9-1 11.2-1 2.1 0 4.3 0.1 6.4 0.3 2.1 0.1 4.2 0.3 6.1 0.3 3.2 0 5.2-0.4 5.9-1.2 2.7-2.7 2.8-8.8 2.9-14.6 0.1-6.7 0.2-14.5 4.6-18.7 -0.5 0-1 0-1.6 0 -14.2 0-37.5 0-41.1 0C15.6 6.2 14.9 23.6 18.9 32.6z"/>
<path d="M90.1 29.7c1-3.3 1.5-7.3 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3 0.6-7.7-0.4-14.4C30.7 70.1 27.5 70.8 24.7 71z"
/>
<path
d="M58.8 68.9c2.9-0.1 6.4-0.9 8.3-1.4 0.1-0.8 0.3-2.8-0.7-3.5 -0.5-0.2-2.5-0.4-5.9-0.4 -4.9 0-8.6 0.4-9.5 0.7 -0.3 0.5-0.5 1.9-0.5 3.3C52.5 68.1 56 69 58.8 68.9z"
/>
<path
d="M24.3 68.4c2.9-0.1 6.4-0.9 8.3-1.4 0.1-0.8 0.3-2.8-0.7-3.5 -0.5-0.2-2.5-0.4-5.9-0.4 -4.9 0-8.6 0.4-9.5 0.7 -0.3 0.5-0.5 1.9-0.5 3.3C18 67.7 21.5 68.6 24.3 68.4z"
/>
<path
d="M60.1 71.4v3.3h-5.2v-3.4c-1.7-0.3-3.3-0.7-4.6-1 -0.9 6.8-1.1 13.3-0.3 14.5 0.4 0.3 2.9 1.1 8 1.1h0c5 0 8.8-0.7 9.7-1.3 0.8-1.3 0.6-7.7-0.4-14.4C65.5 70.5 62.7 71.1 60.1 71.4z"
/>

<!-- <text x="0" y="115" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Natalia Woodroffe</text>
<text x="0" y="120" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text> -->
</svg>
Expand All @@ -37,7 +48,7 @@
alt="image of a high mountain lake"
/>
<div class="logo logo--square">
<img src="/images/noun_Tent_2517.svg" alt="tent image for logo">
<img src="/images/noun_Tent_2517.svg" alt="tent image for logo" />
<div>Sleep<span class="highlight">Outside</span></div>
</div>
</div>
Expand All @@ -55,48 +66,47 @@ <h2>Top Products</h2>
<ul class="product-list">
<li class="product-card">
<a href="product_pages/marmot-ajax-3.html">
<img
src="images/tents/marmot-ajax-tent-3-person-3-season-in-pale-pumpkin-terracotta~p~880rr_01~320.jpg"
alt="Marmot Ajax tent"
/>
<h3 class="card__brand">Marmot</h3>
<h2 class="card__name">Ajax Tent - 3-Person, 3-Season</h2>
<p class="product-card__price">$199.99</p></a>
<img
src="images/tents/marmot-ajax-tent-3-person-3-season-in-pale-pumpkin-terracotta~p~880rr_01~320.jpg"
alt="Marmot Ajax tent"
/>
<h3 class="card__brand">Marmot</h3>
<h2 class="card__name">Ajax Tent - 3-Person, 3-Season</h2>
<p class="product-card__price">$199.99</p></a
>
</li>
<li class="product-card">
<a href="product_pages/northface-talus-4.html">
<img
src="images/tents/the-north-face-talus-tent-4-person-3-season-in-golden-oak-saffron-yellow~p~985rf_01~320.jpg"
alt="Talus Tent - 4-Person, 3-Season"
/>
<h3 class="card__brand">The North Face</h3>
<h2 class="card__name">Talus Tent - 4-Person, 3-Season</h2>
<p class="product-card__price">$199.99</p></a>
</li>
<img
src="images/tents/the-north-face-talus-tent-4-person-3-season-in-golden-oak-saffron-yellow~p~985rf_01~320.jpg"
alt="Talus Tent - 4-Person, 3-Season"
/>
<h3 class="card__brand">The North Face</h3>
<h2 class="card__name">Talus Tent - 4-Person, 3-Season</h2>
<p class="product-card__price">$199.99</p></a
>
</li>
<li class="product-card">
<a href="product_pages/northface-alpine-3.html">
<img
src="images/tents/the-north-face-alpine-guide-tent-3-person-4-season-in-canary-yellow-high-rise-grey~p~985pr_01~320.jpg"
alt="Alpine Guide Tent - 3-Person, 4-Season"
/>
<h3 class="card__brand">The North Face</h3>
<h2 class="card__name">
Alpine Guide Tent - 3-Person, 4-Season
</h2>
<p class="product-card__price">$349.99</p></a>
<img
src="images/tents/the-north-face-alpine-guide-tent-3-person-4-season-in-canary-yellow-high-rise-grey~p~985pr_01~320.jpg"
alt="Alpine Guide Tent - 3-Person, 4-Season"
/>
<h3 class="card__brand">The North Face</h3>
<h2 class="card__name">Alpine Guide Tent - 3-Person, 4-Season</h2>
<p class="product-card__price">$349.99</p></a
>
</li>
<li class="product-card">
<a href="product_pages/cedar-ridge-rimrock-2.html">
<img
src="images/tents/cedar-ridge-rimrock-tent-2-person-3-season-in-rust-clay~p~344yj_01~320.jpg"
alt="Rimrock Tent - 2-Person, 3-Season"
/>
<h3 class="card__brand">Cedar Ridge</h3>
<h2 class="card__name">
Rimrock Tent - 2-Person, 3-Season
</h2>
<p class="product-card__price">$69.99</p></a>
<img
src="images/tents/cedar-ridge-rimrock-tent-2-person-3-season-in-rust-clay~p~344yj_01~320.jpg"
alt="Rimrock Tent - 2-Person, 3-Season"
/>
<h3 class="card__brand">Cedar Ridge</h3>
<h2 class="card__name">Rimrock Tent - 2-Person, 3-Season</h2>
<p class="product-card__price">$69.99</p></a
>
</li>
</ul>
</section>
Expand Down
15 changes: 13 additions & 2 deletions src/js/product.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { setLocalStorage } from "./utils.mjs";
import { setLocalStorage, getLocalStorage } from "./utils.mjs";
import ProductData from "./ProductData.mjs";

const dataSource = new ProductData("tents");

function addProductToCart(product) {
setLocalStorage("so-cart", product);
const soCart = getLocalStorage("so-cart");

if (soCart === null) {
let productStorage = [product];
setLocalStorage("so-cart", productStorage);
} else {
soCart.push(product);
setLocalStorage("so-cart", soCart);
}
}
// add to cart button event handler
async function addToCartHandler(e) {
const product = await dataSource.findProductById(e.target.dataset.id);
addProductToCart(product);

// window.location.href = "../";
document.getElementById("addToCart").textContent = "Product Added";
}

// add listener to Add to Cart button
Expand Down
Loading