Skip to content

Commit

Permalink
fix various storybook error
Browse files Browse the repository at this point in the history
  • Loading branch information
ajouguelet committed Sep 5, 2024
1 parent 0be45ce commit 078ed57
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
16 changes: 10 additions & 6 deletions components/Organisms/Modules/StoreDelivery/StoreDelivery.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
{% endif %}

{% if not newClient %}
<span class='StoreDelivery-opening {% if closed %}closed{% endif %}'>{{ 'Close'|trans }}{% else %}{{ 'Open'|trans }}{% endif %}{{ 'currently'|trans }}</span>
<span class='StoreDelivery-address'>
<span>{{ address.address1 }},</span>
{% if address.address2 %}<span>{{ address.address2 }},</span>{% endif %}
<span>{{ address.zipCode }} {{ address.city }}</span>
</span>
{% if closed %}
<span class='StoreDelivery-opening closed'>{{ 'Close'|trans }} {{ 'currently'|trans }}</span>
{% else %}
<span class='StoreDelivery-opening'>{{ 'Open'|trans }} {{ 'currently'|trans }}</span>
{% endif %}
<span class='StoreDelivery-address'>
<span>{{ address.address1 }},</span>
{% if address.address2 %}<span>{{ address.address2 }},</span>{% endif %}
<span>{{ address.zipCode }} {{ address.city }}</span>
</span>
{% endif %}

</span>
Expand Down
19 changes: 15 additions & 4 deletions components/Organisms/ProductCard/ProductCard.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@
{% set quantityChoice = quantityChoice|default(1) %}

{% if productSaleElements is defined %}
{% set price = productSaleElements|filter(pse => pse.isDefault)|first.productPrices|first.price ~ '' %}
{% set promoPrice = productSaleElements|filter(pse => pse.isDefault)|first.productPrices|first.promoPrice ~ '' %}
{% set isPromo = productSaleElements|filter(pse => pse.isDefault)|first.promo %}
{% set isNew = productSaleElements|filter(pse => pse.isDefault)|first.newness %}

{% set defaultPse = null %}

{% for pse in productSaleElements %}
{% if pse.isDefault %}
{% set defaultPse = pse %}
{% endif %}
{% endfor %}

{% set price = defaultPse.productPrices|first.price ~ '' %}
{% set promoPrice = defaultPse.productPrices|first.promoPrice ~ '' %}

{% set isPromo = defaultPse ? defaultPse.promo|default(false) : false %}
{% set isNew = defaultPse ? defaultPse.newness|default(false) : false %}

{% endif %}
{% if id is defined and img is not defined %}
{% set images = resources('/api/front/product_images', {'product.id':id, itemsPerPage:1}) %}
Expand Down
14 changes: 14 additions & 0 deletions twig/custom-twig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ import IconTwig from './IconTwig.twig';
Twig.extendFunction('svg', (iconName: string): string => {
return IconTwig({ icon: iconName });
});

Twig.extend(function (Twig) {
Twig.filters.trans = function (value) {
return value;
};

Twig.exports.functions.t = function (value) {
return value;
};

Twig.exports.functions.resources = function (value) {
return value;
};
});

0 comments on commit 078ed57

Please sign in to comment.