Skip to content

Commit

Permalink
compact header kick off, more buttons, styling overall
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricius Seifert committed Feb 24, 2024
1 parent 66d5704 commit 3858b45
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/checkout/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { html } from "../utils.js";
export default ({
tag = "button",
href,
type,
value,
onClick,
disabled,
rounded,
className,
Expand All @@ -12,6 +15,9 @@ export default ({
return html` <${href ? "a" : tag}
${disabled ? "disabled" : ""}
${href ? `href="${href}"` : ""}
${type ? `type="${type}"` : ""}
${value ? `value="${value}"` : ""}
${onClick ? `onclick="${onClick}"` : ""}
class="c_Button c_Button--${variant} ${className} ${rounded ? "c_Button--rounded" : ""}"
ontouchstart
>
Expand Down
21 changes: 21 additions & 0 deletions src/checkout/components/CompactHeader.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.c_CompactHeader {
height: 135px;
display: flex;
margin: 0 0 2rem;
border-bottom: 1px solid #eeebe2;
box-shadow: 0 0 20px 10px #eb5b5920;
align-items: center;
}

.c_CompactHeader__inner {
display: flex;
max-width: 1000px;
margin: 0 auto;
align-items: center;
flex: 1;
}

.c_CompactHeader__logo {
display: block;
width: 270px;
}
12 changes: 10 additions & 2 deletions src/checkout/components/CompactHeader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { html } from "../utils.js";

export default () => {
return html`<header>
<h1><a href="/">Tractor Store</a></h1>
return html`<header class="c_CompactHeader">
<div class="c_CompactHeader__inner">
<a class="c_CompactHeader__link" href="/">
<img
class="c_CompactHeader__logo"
src="/cdn/img/logo.svg"
alt="Micro Frontends - Tractor Store"
/>
</a>
</div>
</header>`;
};
8 changes: 7 additions & 1 deletion src/checkout/components/LineItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { html } from "../utils.js";
import Button from "./Button.js";

export default ({ sku, id, name, quantity, price, image }) => {
const url = `/product/${id}?sku=${sku}`;
Expand All @@ -13,7 +14,12 @@ export default ({ sku, id, name, quantity, price, image }) => {
<div class="c_LineItem__price">${price * quantity} Ø</div>
<form action="/checkout/cart/remove" method="post">
<input type="hidden" name="sku" value="${sku}" />
<input type="submit" value="remove" />
${Button({
variant: "secondary",
type: "submit",
value: "remove",
children: "Remove",
})}
</form>
</li>`;
};
2 changes: 1 addition & 1 deletion src/checkout/components/MiniCart.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
}

.c_MiniCart--highlight .c_MiniCart__inner svg {
.c_MiniCart--highlight svg {
animation: bounce 0.2s ease-out;
}

Expand Down
1 change: 1 addition & 0 deletions src/checkout/components/MiniCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export default ({ req }) => {
<div class="c_MiniCart__quantity">${quantity || ""}</div>
`,
})}

Check failure on line 35 in src/checkout/components/MiniCart.js

View workflow job for this annotation

GitHub Actions / build-and-deploy

Delete `··⏎··`
</div>`;
};
11 changes: 11 additions & 0 deletions src/checkout/pages/CartPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@
text-align: right;
font-weight: bold;
}

.c_CartPage__buttons {
display: flex;
justify-content: space-between;
margin-top: 4rem;
gap: 2rem;
}

.c_CartPage__buttons > * {
flex: 0;
}
18 changes: 15 additions & 3 deletions src/checkout/pages/CartPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { html } from "../utils.js";
import Header from "../../explore/components/Header.js";
import Footer from "../../explore/components/Footer.js";
import Recommendations from "../../explore/components/Recommendations.js";
import Button from "../components/Button.js";

export default ({ req }) => {
const lineItems = readFromCookie(req).map(({ sku, quantity }) => {
Expand All @@ -31,9 +32,20 @@ export default ({ req }) => {
Ø
</p>
<form action="/checkout/checkout" method="get">
<button>checkout</button>
</form>
<div class="c_CartPage__buttons">
${Button({
onClick: "history.back()",
children: "Continue Shopping",
variant: "secondary",
})}
${Button({
tag: "a",
href: "/checkout/checkout",
children: "Checkout",
variant: "primary",
})}
</div>
${Recommendations({ skus })} ${Footer()}
</main>
`;
Expand Down
1 change: 1 addition & 0 deletions src/checkout/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import url("./components/AddToCart.css");
@import url("./components/LineItem.css");
@import url("./components/Button.css");
@import url("./components/CompactHeader.css");

@font-face {
font-family: "Raleway";
Expand Down
1 change: 1 addition & 0 deletions src/decide/pages/ProductPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
display: flex;
flex-wrap: wrap;
list-style: none;
margin-top: 3rem;
padding: 0;
}

Expand Down
4 changes: 2 additions & 2 deletions src/explore/components/Product.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
}

.e_Product_name {
margin: 1rem 0;
margin: 12px 0 8px;
color: black;
text-align: center;
display: block;
}

.e_Product_price {
margin: 1rem 0;
margin: 8px 0;
color: black;
text-align: center;
display: block;
Expand Down

0 comments on commit 3858b45

Please sign in to comment.