mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2024-12-24 21:50:43 -05:00
Compare commits
2 commits
aca34ffb10
...
0700245525
Author | SHA1 | Date | |
---|---|---|---|
0700245525 | |||
907aac1b75 |
10 changed files with 144 additions and 9 deletions
82
shopping-cart/app/assets/index-B-lFhr22.js
Normal file
82
shopping-cart/app/assets/index-B-lFhr22.js
Normal file
File diff suppressed because one or more lines are too long
1
shopping-cart/app/assets/index-BNTrPwWY.css
Normal file
1
shopping-cart/app/assets/index-BNTrPwWY.css
Normal file
|
@ -0,0 +1 @@
|
|||
:root{font-family:Inter,system-ui,sans-serif;line-height:1.5;font-weight:400;font-size:18px;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{margin:0;display:flex}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.roboto-condensed-fnt{font-family:Roboto Condensed,sans-serif;font-optical-sizing:auto;font-weight:400;font-style:normal}#root{margin:0 auto;padding:0;width:100%}._container_xopze_1{display:flex;justify-content:space-between;padding:0 1rem}._nav_xopze_8{display:flex;list-style-type:none;gap:20px;padding-right:1rem;margin-left:auto;align-self:center}._link_xopze_19{text-decoration:none;font-size:1.5rem;color:#0e374e}._nav-heading_xopze_25{color:#0e374e}._cart-icon-container_xopze_29{position:relative}._cart-icon-circle_xopze_33{background:#85d5f4;border-radius:50%;height:20px;width:20px;position:absolute;top:7px;left:10px;opacity:60%}._btn_1oi8g_1{padding:1rem;margin:1rem;font-size:1rem;border-radius:.5rem;border:none;cursor:pointer}._action_1oi8g_10{color:red}._container_wwoz3_1{display:flex;justify-content:space-between}._empty-cart_wwoz3_6{width:100%;display:flex;justify-content:center;align-items:flex-start;margin-top:.5rem}._summary_wwoz3_14{margin-right:3rem;padding:1rem;display:inline-block;min-width:250px}._fullwidth_wwoz3_21{width:100%}._card_wwoz3_25{display:flex;flex-direction:column;margin:0 2rem;justify-content:center;align-items:center}._cartItems_wwoz3_33{display:flex;flex-direction:column;gap:2.5rem;align-items:space-between;justify-content:space-between;align-content:flex-start}._cartItem_wwoz3_33{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));justify-items:center;padding:2rem 0;position:relative}._cartItem_wwoz3_33:after{content:"";position:absolute;border-bottom:solid black;margin:auto;left:0;bottom:0;right:0;height:1px;width:50%;border-bottom:1px solid black}._price-qty_wwoz3_63{display:flex;gap:30px;justify-content:center}._price-qty_wwoz3_63 p{margin:0}._qtybtn_wwoz3_73{display:flex}._qtyp_wwoz3_77{font-size:1.3rem;padding:.5rem;margin:.5rem}#_img_wwoz3_1{max-width:100%;max-height:300px;object-fit:contain;border-radius:2rem;align-self:center}._header_wwoz3_91{margin:1rem}._input_wwoz3_95{max-width:30px}main{padding:0 1rem}._container_exc1g_5{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100vh}._mainHeading_exc1g_13{font-size:4rem;margin:0}._sub-heading_exc1g_18{font-size:1.5rem}._heading-color_exc1g_22{color:#0e6c96}._hero-img_exc1g_26{margin-top:100px;width:100%;max-height:800px;vertical-align:middle;object-fit:contain;float:left}._img_1sizt_1{width:100%;max-height:300px;vertical-align:middle;object-fit:contain;float:left}._container_1lsd1_1{display:flex;gap:2rem;justify-content:center;flex-wrap:wrap;align-items:stretch;text-align:center}._card_1lsd1_9{display:flex;flex-direction:column;max-width:20%;justify-content:end;padding:1.5rem;margin:1.5rem;border-radius:1rem}._link_1lsd1_20{text-decoration:none;color:#0e374e;font-weight:600;transition:font-weight .5s}._link_1lsd1_20:hover{font-weight:900}._container_1wfgo_1{display:flex;gap:2rem;justify-content:center;flex-wrap:wrap;align-items:stretch}._card_1wfgo_8{display:flex;flex-direction:column;max-width:350px;justify-content:end;padding:1.5rem;margin:1.5rem;background:#e2f3fc;border-radius:1rem;text-align:center}._link_1wfgo_20{text-decoration:none;color:#0e374e;font-weight:600;transition:font-weight .5s}._link_1wfgo_20:hover{font-weight:900}
|
BIN
shopping-cart/app/favicon.png
Normal file
BIN
shopping-cart/app/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 KiB |
BIN
shopping-cart/app/favicon.png.bak
Normal file
BIN
shopping-cart/app/favicon.png.bak
Normal file
Binary file not shown.
After Width: | Height: | Size: 112 KiB |
BIN
shopping-cart/app/hero.jpg
Normal file
BIN
shopping-cart/app/hero.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 481 KiB |
20
shopping-cart/app/index.html
Normal file
20
shopping-cart/app/index.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Hobby Tech</title>
|
||||
<script type="module" crossorigin src="/assets/index-B-lFhr22.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BNTrPwWY.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
1
shopping-cart/app/shopping_cart_icon.svg
Normal file
1
shopping-cart/app/shopping_cart_icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M280-80q-33 0-56.5-23.5T200-160q0-33 23.5-56.5T280-240q33 0 56.5 23.5T360-160q0 33-23.5 56.5T280-80Zm400 0q-33 0-56.5-23.5T600-160q0-33 23.5-56.5T680-240q33 0 56.5 23.5T760-160q0 33-23.5 56.5T680-80ZM246-720l96 200h280l110-200H246Zm-38-80h590q23 0 35 20.5t1 41.5L692-482q-11 20-29.5 31T622-440H324l-44 80h480v80H280q-45 0-68-39.5t-2-78.5l54-98-144-304H40v-80h130l38 80Zm134 280h280-280Z"/></svg>
|
After Width: | Height: | Size: 511 B |
1
shopping-cart/app/vite.svg
Normal file
1
shopping-cart/app/vite.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -66,7 +66,10 @@ function OrderSummary({ cart }) {
|
|||
</p>
|
||||
<p>Shipping (10%): ${currencyFormat(shippingCosts)}</p>
|
||||
<p>Total: ${currencyFormat(total)}</p>
|
||||
<Button text={"Checkout"} />
|
||||
<Button
|
||||
text={"Checkout"}
|
||||
onClick={() => alert("Congrats! You would've leveled up")}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -80,15 +83,21 @@ function CartItem({ item, cart, setCart }) {
|
|||
<div className={styles.card}>
|
||||
<div>
|
||||
<h3>{title}</h3>
|
||||
<p>Price: ${currencyFormat(price)} x </p>
|
||||
</div>
|
||||
<div className={styles.qtybtn}>
|
||||
<button onClick={() => decreaseQty(item, cart, setCart)}>-</button>
|
||||
<QuantityInput item={item} cart={cart} setCart={setCart} />
|
||||
<button onClick={() => increaseQty(item, cart, setCart)}>+</button>
|
||||
<div className={styles["price-qty"]}>
|
||||
<p> ${currencyFormat(price)} x </p>
|
||||
<div className={styles.qtybtn}>
|
||||
<button onClick={() => decreaseQty(item, cart, setCart)}>
|
||||
-
|
||||
</button>
|
||||
<QuantityInput item={item} cart={cart} setCart={setCart} />
|
||||
<button onClick={() => increaseQty(item, cart, setCart)}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
<p>Item total: ${currencyFormat(qty * price)} </p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p>total: ${currencyFormat(qty * price)} </p>
|
||||
<Button
|
||||
onClick={() => removeFromCart(item, cart, setCart)}
|
||||
text={"Remove From Cart"}
|
||||
|
@ -112,7 +121,14 @@ function QuantityInput({ item, cart, setCart }) {
|
|||
}
|
||||
|
||||
return (
|
||||
<input value={item.qty} onChange={handleChange} min="1" type="number" />
|
||||
<input
|
||||
value={item.qty}
|
||||
onChange={handleChange}
|
||||
min="1"
|
||||
max="999"
|
||||
type="number"
|
||||
className={styles.input}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,16 @@
|
|||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.price-qty {
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.price-qty p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.qtybtn {
|
||||
display: flex;
|
||||
}
|
||||
|
@ -81,3 +91,7 @@
|
|||
.header {
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.input {
|
||||
max-width: 30px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue