Skip to content

Commit

Permalink
CIF-2196 - Introduce a staged modifier to allow better styling of sta…
Browse files Browse the repository at this point in the history
…ged items (#612)

* add --staged modifier for product full detail
  • Loading branch information
buuhuu authored Jul 14, 2021
1 parent 80890e8 commit 6d4d2aa
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,8 @@
~ governing permissions and limitations under the License.
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<sly data-sly-use.variantsTpl="variantselector.html"
data-sly-use.galleryTpl="gallery.html"
data-sly-use.actionsTpl="actions.html"
data-sly-use.quantityTpl="quantity.html"
data-sly-use.titleTpl="title.html"
data-sly-use.descriptionTpl="description.html"
data-sly-use.skuTpl="sku.html"
data-sly-use.priceTpl="core/cif/components/commons/v1/price.html"
data-sly-use.groupedProductsTpl="groupedProducts.html"
data-sly-use.product="com.adobe.cq.commerce.core.components.models.product.Product"
data-sly-use.page="com.adobe.cq.wcm.core.components.models.Page">

<form class="productFullDetail__root"
id="${product.id}"
data-configurable="${product.configurable}"
data-grouped="${product.groupedProduct}"
data-virtual="${product.virtualProduct}"
data-cmp-is="product"
data-locale="${page.language}"
data-cmp-data-layer="${product.data.json}"
data-cif-product-context="${product.storefrontContext.json}"
data-load-client-price="${product.loadClientPrice}">
<sly data-sly-test.found="${product.found}">
<sly data-sly-test.isGroupedProduct="${product.isGroupedProduct}" />
<sly data-sly-test.isBundleProduct="${product.isBundleProduct}" />
<section class="productFullDetail__title">
<sly data-sly-call="${titleTpl.product @ product=product}"></sly>
<sly data-sly-test="${!isGroupedProduct}"
data-sly-call="${priceTpl.price @ priceRange=product.priceRange, displayYouSave=true, sku=product.sku}"></sly>
</section>
<section class="productFullDetail__imageCarousel">
<sly data-sly-call="${galleryTpl.gallery @ product=product}" data-sly-unwrap></sly>
</section>
<section class="productFullDetail__options" data-sly-test="${product.configurable}" data-variants="${product.variantsJson}">
<sly data-sly-call="${variantsTpl.variants @ product=product}" data-sly-unwrap></sly>
</section>
<section data-sly-test="${isGroupedProduct}" class="productFullDetail__groupedProducts productFullDetail__quantity productFullDetail__section">
<sly data-sly-call="${groupedProductsTpl.groupedProducts @ groupedProductItems=product.groupedProductItems}"></sly>
</section>
<div data-sly-test="${isBundleProduct}" id="bundle-product-options" data-sku="${product.sku}"></div>
<section data-sly-test="${!isGroupedProduct && !isBundleProduct}" class="productFullDetail__quantity productFullDetail__section">
<h2 class="productFullDetail__quantityTitle option__title"><span>${'Quantity' @ i18n}</span></h2>
<sly data-sly-call="${quantityTpl.quantity @ product=product}"></sly>
</section>
<section data-sly-test="${!isBundleProduct}" class="productFullDetail__cartActions productFullDetail__section">
<sly data-sly-call="${actionsTpl.actions @ product=product}"></sly>
</section>
<section class="productFullDetail__description productFullDetail__section">
<sly data-sly-call="${descriptionTpl.product @ product=product}"></sly>
</section>
<section class="productFullDetail__details productFullDetail__section">
<sly data-sly-call="${skuTpl.product @ product=product}"></sly>
</section>
</sly>
<p data-sly-test="${!found}">${'Product not found.' @ i18n}</p>
</form>
<sly data-sly-use.product="com.adobe.cq.commerce.core.components.models.product.Product"
data-sly-use.page="com.adobe.cq.wcm.core.components.models.Page"
data-sly-use.productFullDetailTpl="productFullDetail.html"
data-sly-call="${productFullDetailTpl.productFullDetail @ page=page, product=product}">
</sly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
~ Copyright 2019 Adobe. All rights reserved.
~ This file is licensed to you under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. You may obtain a copy
~ of the License at http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software distributed under
~ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
~ OF ANY KIND, either express or implied. See the License for the specific language
~ governing permissions and limitations under the License.
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.productFullDetail="${ @ page, product, additionalCssClasses }"
data-sly-use.variantsTpl="variantselector.html"
data-sly-use.galleryTpl="gallery.html"
data-sly-use.actionsTpl="actions.html"
data-sly-use.quantityTpl="quantity.html"
data-sly-use.titleTpl="title.html"
data-sly-use.descriptionTpl="description.html"
data-sly-use.skuTpl="sku.html"
data-sly-use.priceTpl="core/cif/components/commons/v1/price.html"
data-sly-use.groupedProductsTpl="groupedProducts.html">

<form class="productFullDetail__root ${additionalCssClasses}"
id="${product.id}"
data-configurable="${product.configurable}"
data-grouped="${product.groupedProduct}"
data-virtual="${product.virtualProduct}"
data-cmp-is="product"
data-locale="${page.language}"
data-cmp-data-layer="${product.data.json}"
data-cif-product-context="${product.storefrontContext.json}"
data-load-client-price="${product.loadClientPrice}">
<sly data-sly-test.found="${product.found}">
<sly data-sly-test.isGroupedProduct="${product.isGroupedProduct}" />
<sly data-sly-test.isBundleProduct="${product.isBundleProduct}" />
<section class="productFullDetail__title">
<sly data-sly-call="${titleTpl.product @ product=product}"></sly>
<sly data-sly-test="${!isGroupedProduct}"
data-sly-call="${priceTpl.price @ priceRange=product.priceRange, displayYouSave=true, sku=product.sku}"></sly>
</section>
<section class="productFullDetail__imageCarousel">
<sly data-sly-call="${galleryTpl.gallery @ product=product}" data-sly-unwrap></sly>
</section>
<section class="productFullDetail__options" data-sly-test="${product.configurable}" data-variants="${product.variantsJson}">
<sly data-sly-call="${variantsTpl.variants @ product=product}" data-sly-unwrap></sly>
</section>
<section data-sly-test="${isGroupedProduct}" class="productFullDetail__groupedProducts productFullDetail__quantity productFullDetail__section">
<sly data-sly-call="${groupedProductsTpl.groupedProducts @ groupedProductItems=product.groupedProductItems}"></sly>
</section>
<div data-sly-test="${isBundleProduct}" id="bundle-product-options" data-sku="${product.sku}"></div>
<section data-sly-test="${!isGroupedProduct && !isBundleProduct}" class="productFullDetail__quantity productFullDetail__section">
<h2 class="productFullDetail__quantityTitle option__title"><span>${'Quantity' @ i18n}</span></h2>
<sly data-sly-call="${quantityTpl.quantity @ product=product}"></sly>
</section>
<section data-sly-test="${!isBundleProduct}" class="productFullDetail__cartActions productFullDetail__section">
<sly data-sly-call="${actionsTpl.actions @ product=product}"></sly>
</section>
<section class="productFullDetail__description productFullDetail__section">
<sly data-sly-call="${descriptionTpl.product @ product=product}"></sly>
</section>
<section class="productFullDetail__details productFullDetail__section">
<sly data-sly-call="${skuTpl.product @ product=product}"></sly>
</section>
</sly>
<p data-sly-test="${!found}">${'Product not found.' @ i18n}</p>
</form>

</template>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ In addition to the elements documented for the version 1 of the product componen

```
BLOCK product
MOD productFullDetail__root--staged
ELEMENT productFullDetail__staged
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
~ Copyright 2019 Adobe. All rights reserved.
~ This file is licensed to you under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. You may obtain a copy
~ of the License at http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software distributed under
~ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
~ OF ANY KIND, either express or implied. See the License for the specific language
~ governing permissions and limitations under the License.
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<sly data-sly-use.product="com.adobe.cq.commerce.core.components.models.product.Product"
data-sly-use.page="com.adobe.cq.wcm.core.components.models.Page"
data-sly-use.productFullDetailTpl="productFullDetail.html"
data-sly-call="${productFullDetailTpl.productFullDetail @ page=page, product=product, additionalCssClasses=product.isStaged ? 'productFullDetail__root--staged' : ''}">
</sly>

0 comments on commit 6d4d2aa

Please sign in to comment.