Skip to content

Commit 72a34b2

Browse files
committed
add slots to mini cart
1 parent 5130dda commit 72a34b2

File tree

9 files changed

+91
-33
lines changed

9 files changed

+91
-33
lines changed
Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,75 @@
1-
import { render as provider } from '@dropins/storefront-cart/render.js';
2-
import MiniCart from '@dropins/storefront-cart/containers/MiniCart.js';
1+
import { render as provider } from "@dropins/storefront-cart/render.js";
2+
import MiniCart from "@dropins/storefront-cart/containers/MiniCart.js";
33

44
// Initializers
5-
import '../../scripts/initializers/cart.js';
5+
import "../../scripts/initializers/cart.js";
66

7-
import { readBlockConfig } from '../../scripts/aem.js';
7+
import { readBlockConfig } from "../../scripts/aem.js";
88

99
export default async function decorate(block) {
1010
const {
11-
'start-shopping-url': startShoppingURL = '',
12-
'cart-url': cartURL = '',
13-
'checkout-url': checkoutURL = '',
11+
"start-shopping-url": startShoppingURL = "",
12+
"cart-url": cartURL = "",
13+
"checkout-url": checkoutURL = "",
1414
} = readBlockConfig(block);
1515

16-
block.innerHTML = '';
16+
block.innerHTML = "";
1717

1818
return provider.render(MiniCart, {
1919
routeEmptyCartCTA: startShoppingURL ? () => startShoppingURL : undefined,
2020
routeCart: cartURL ? () => cartURL : undefined,
2121
routeCheckout: checkoutURL ? () => checkoutURL : undefined,
22-
routeProduct: (product) => `/products/${product.url.urlKey}/${product.topLevelSku}`,
22+
routeProduct: (product) =>
23+
`/products/${product.url.urlKey}/${product.topLevelSku}`,
24+
slots: {
25+
ProductListFooter: (ctx) => {
26+
const productListFooter = document.createElement("div");
27+
28+
// Create a wrapper div for the shadow background
29+
const shadowWrapper = document.createElement("div");
30+
shadowWrapper.style.backgroundColor = "#EFF5EF";
31+
shadowWrapper.style.borderRadius = "5px";
32+
33+
// Create the content div
34+
const contentDiv = document.createElement("div");
35+
contentDiv.innerHTML =
36+
"<p style='line-height: 1.5;'>Enjoy hassle-free shopping with our 30-day return policy!</p>";
37+
contentDiv.style.display = "flex";
38+
contentDiv.style.flexDirection = "column";
39+
contentDiv.style.padding = "12px";
40+
41+
// Append the content div to the shadow wrapper
42+
shadowWrapper.appendChild(contentDiv);
43+
44+
// Append the shadow wrapper to the productListFooter div
45+
productListFooter.appendChild(shadowWrapper);
46+
47+
ctx.appendChild(productListFooter);
48+
},
49+
PreCheckoutSection: (ctx) => {
50+
const productListFooter = document.createElement("div");
51+
52+
// Create a wrapper div for the shadow background
53+
const shadowWrapper = document.createElement("div");
54+
shadowWrapper.style.backgroundColor = "#EEEFFB";
55+
shadowWrapper.style.borderRadius = "5px";
56+
57+
// Create the content div
58+
const contentDiv = document.createElement("div");
59+
contentDiv.innerHTML =
60+
"<p style='line-height: 1.5;'>Earn rewards every time you shop! Sign up for our free loyalty program today and start earning points on this purchase.</p>";
61+
contentDiv.style.display = "flex";
62+
contentDiv.style.flexDirection = "column";
63+
contentDiv.style.padding = "12px";
64+
65+
// Append the content div to the shadow wrapper
66+
shadowWrapper.appendChild(contentDiv);
67+
68+
// Append the shadow wrapper to the productListFooter div
69+
productListFooter.appendChild(shadowWrapper);
70+
71+
ctx.appendChild(productListFooter);
72+
},
73+
},
2374
})(block);
2475
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@adobe/magento-storefront-events-sdk": "^1.8.0",
3838
"@dropins/storefront-account": "~1.0.2",
3939
"@dropins/storefront-auth": "~1.0.2",
40-
"@dropins/storefront-cart": "~1.0.2",
40+
"@dropins/storefront-cart": "~1.0.3-alpha2",
4141
"@dropins/storefront-checkout": "~1.0.0",
4242
"@dropins/storefront-order": "~1.0.2",
4343
"@dropins/storefront-pdp": "~1.0.0",

scripts/__dropins__/storefront-cart/chunks/Coupon.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)