forked from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,75 @@ | ||
import { render as provider } from '@dropins/storefront-cart/render.js'; | ||
import MiniCart from '@dropins/storefront-cart/containers/MiniCart.js'; | ||
import { render as provider } from "@dropins/storefront-cart/render.js"; | ||
import MiniCart from "@dropins/storefront-cart/containers/MiniCart.js"; | ||
|
||
// Initializers | ||
import '../../scripts/initializers/cart.js'; | ||
import "../../scripts/initializers/cart.js"; | ||
|
||
import { readBlockConfig } from '../../scripts/aem.js'; | ||
import { readBlockConfig } from "../../scripts/aem.js"; | ||
|
||
export default async function decorate(block) { | ||
const { | ||
'start-shopping-url': startShoppingURL = '', | ||
'cart-url': cartURL = '', | ||
'checkout-url': checkoutURL = '', | ||
"start-shopping-url": startShoppingURL = "", | ||
"cart-url": cartURL = "", | ||
"checkout-url": checkoutURL = "", | ||
} = readBlockConfig(block); | ||
|
||
block.innerHTML = ''; | ||
block.innerHTML = ""; | ||
|
||
return provider.render(MiniCart, { | ||
routeEmptyCartCTA: startShoppingURL ? () => startShoppingURL : undefined, | ||
routeCart: cartURL ? () => cartURL : undefined, | ||
routeCheckout: checkoutURL ? () => checkoutURL : undefined, | ||
routeProduct: (product) => `/products/${product.url.urlKey}/${product.topLevelSku}`, | ||
routeProduct: (product) => | ||
`/products/${product.url.urlKey}/${product.topLevelSku}`, | ||
slots: { | ||
ProductListFooter: (ctx) => { | ||
const productListFooter = document.createElement("div"); | ||
|
||
// Create a wrapper div for the shadow background | ||
const shadowWrapper = document.createElement("div"); | ||
shadowWrapper.style.backgroundColor = "#EFF5EF"; | ||
shadowWrapper.style.borderRadius = "5px"; | ||
|
||
// Create the content div | ||
const contentDiv = document.createElement("div"); | ||
contentDiv.innerHTML = | ||
"<p style='line-height: 1.5;'>Enjoy hassle-free shopping with our 30-day return policy!</p>"; | ||
contentDiv.style.display = "flex"; | ||
contentDiv.style.flexDirection = "column"; | ||
contentDiv.style.padding = "12px"; | ||
|
||
// Append the content div to the shadow wrapper | ||
shadowWrapper.appendChild(contentDiv); | ||
|
||
// Append the shadow wrapper to the productListFooter div | ||
productListFooter.appendChild(shadowWrapper); | ||
|
||
ctx.appendChild(productListFooter); | ||
}, | ||
PreCheckoutSection: (ctx) => { | ||
const productListFooter = document.createElement("div"); | ||
|
||
// Create a wrapper div for the shadow background | ||
const shadowWrapper = document.createElement("div"); | ||
shadowWrapper.style.backgroundColor = "#EEEFFB"; | ||
shadowWrapper.style.borderRadius = "5px"; | ||
|
||
// Create the content div | ||
const contentDiv = document.createElement("div"); | ||
contentDiv.innerHTML = | ||
"<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>"; | ||
contentDiv.style.display = "flex"; | ||
contentDiv.style.flexDirection = "column"; | ||
contentDiv.style.padding = "12px"; | ||
|
||
// Append the content div to the shadow wrapper | ||
shadowWrapper.appendChild(contentDiv); | ||
|
||
// Append the shadow wrapper to the productListFooter div | ||
productListFooter.appendChild(shadowWrapper); | ||
|
||
ctx.appendChild(productListFooter); | ||
}, | ||
}, | ||
})(block); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.