Skip to content

Commit 3858b45

Browse files
author
Fabricius Seifert
committed
compact header kick off, more buttons, styling overall
1 parent 66d5704 commit 3858b45

File tree

11 files changed

+76
-9
lines changed

11 files changed

+76
-9
lines changed

src/checkout/components/Button.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { html } from "../utils.js";
33
export default ({
44
tag = "button",
55
href,
6+
type,
7+
value,
8+
onClick,
69
disabled,
710
rounded,
811
className,
@@ -12,6 +15,9 @@ export default ({
1215
return html` <${href ? "a" : tag}
1316
${disabled ? "disabled" : ""}
1417
${href ? `href="${href}"` : ""}
18+
${type ? `type="${type}"` : ""}
19+
${value ? `value="${value}"` : ""}
20+
${onClick ? `onclick="${onClick}"` : ""}
1521
class="c_Button c_Button--${variant} ${className} ${rounded ? "c_Button--rounded" : ""}"
1622
ontouchstart
1723
>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.c_CompactHeader {
2+
height: 135px;
3+
display: flex;
4+
margin: 0 0 2rem;
5+
border-bottom: 1px solid #eeebe2;
6+
box-shadow: 0 0 20px 10px #eb5b5920;
7+
align-items: center;
8+
}
9+
10+
.c_CompactHeader__inner {
11+
display: flex;
12+
max-width: 1000px;
13+
margin: 0 auto;
14+
align-items: center;
15+
flex: 1;
16+
}
17+
18+
.c_CompactHeader__logo {
19+
display: block;
20+
width: 270px;
21+
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import { html } from "../utils.js";
22

33
export default () => {
4-
return html`<header>
5-
<h1><a href="/">Tractor Store</a></h1>
4+
return html`<header class="c_CompactHeader">
5+
<div class="c_CompactHeader__inner">
6+
<a class="c_CompactHeader__link" href="/">
7+
<img
8+
class="c_CompactHeader__logo"
9+
src="/cdn/img/logo.svg"
10+
alt="Micro Frontends - Tractor Store"
11+
/>
12+
</a>
13+
</div>
614
</header>`;
715
};

src/checkout/components/LineItem.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { html } from "../utils.js";
2+
import Button from "./Button.js";
23

34
export default ({ sku, id, name, quantity, price, image }) => {
45
const url = `/product/${id}?sku=${sku}`;
@@ -13,7 +14,12 @@ export default ({ sku, id, name, quantity, price, image }) => {
1314
<div class="c_LineItem__price">${price * quantity} Ø</div>
1415
<form action="/checkout/cart/remove" method="post">
1516
<input type="hidden" name="sku" value="${sku}" />
16-
<input type="submit" value="remove" />
17+
${Button({
18+
variant: "secondary",
19+
type: "submit",
20+
value: "remove",
21+
children: "Remove",
22+
})}
1723
</form>
1824
</li>`;
1925
};

src/checkout/components/MiniCart.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040
}
4141

42-
.c_MiniCart--highlight .c_MiniCart__inner svg {
42+
.c_MiniCart--highlight svg {
4343
animation: bounce 0.2s ease-out;
4444
}
4545

src/checkout/components/MiniCart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ export default ({ req }) => {
3232
<div class="c_MiniCart__quantity">${quantity || ""}</div>
3333
`,
3434
})}
35+
3536
</div>`;
3637
};

src/checkout/pages/CartPage.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@
1313
text-align: right;
1414
font-weight: bold;
1515
}
16+
17+
.c_CartPage__buttons {
18+
display: flex;
19+
justify-content: space-between;
20+
margin-top: 4rem;
21+
gap: 2rem;
22+
}
23+
24+
.c_CartPage__buttons > * {
25+
flex: 0;
26+
}

src/checkout/pages/CartPage.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { html } from "../utils.js";
66
import Header from "../../explore/components/Header.js";
77
import Footer from "../../explore/components/Footer.js";
88
import Recommendations from "../../explore/components/Recommendations.js";
9+
import Button from "../components/Button.js";
910

1011
export default ({ req }) => {
1112
const lineItems = readFromCookie(req).map(({ sku, quantity }) => {
@@ -31,9 +32,20 @@ export default ({ req }) => {
3132
Ø
3233
</p>
3334
34-
<form action="/checkout/checkout" method="get">
35-
<button>checkout</button>
36-
</form>
35+
<div class="c_CartPage__buttons">
36+
${Button({
37+
onClick: "history.back()",
38+
children: "Continue Shopping",
39+
variant: "secondary",
40+
})}
41+
${Button({
42+
tag: "a",
43+
href: "/checkout/checkout",
44+
children: "Checkout",
45+
variant: "primary",
46+
})}
47+
</div>
48+
3749
${Recommendations({ skus })} ${Footer()}
3850
</main>
3951
`;

src/checkout/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@import url("./components/AddToCart.css");
55
@import url("./components/LineItem.css");
66
@import url("./components/Button.css");
7+
@import url("./components/CompactHeader.css");
78

89
@font-face {
910
font-family: "Raleway";

src/decide/pages/ProductPage.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
display: flex;
3030
flex-wrap: wrap;
3131
list-style: none;
32+
margin-top: 3rem;
3233
padding: 0;
3334
}
3435

src/explore/components/Product.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
}
1616

1717
.e_Product_name {
18-
margin: 1rem 0;
18+
margin: 12px 0 8px;
1919
color: black;
2020
text-align: center;
2121
display: block;
2222
}
2323

2424
.e_Product_price {
25-
margin: 1rem 0;
25+
margin: 8px 0;
2626
color: black;
2727
text-align: center;
2828
display: block;

0 commit comments

Comments
 (0)