Skip to content

Commit

Permalink
Merge pull request #636 from tblivet/issue-559
Browse files Browse the repository at this point in the history
Fix: issue-559
  • Loading branch information
nicosomb authored Jun 7, 2024
2 parents 06f4e14 + 473d247 commit 0ef2d0f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
13 changes: 10 additions & 3 deletions src/scss/custom/components/product/_product-miniature.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ $component-name: product-miniature;
}
}

.variant-links {
> a:first-child {
margin-left: 0;
& &__variants {
.variant-links {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;

> a {
flex-shrink: 0;
margin: 0;
}
}
}
}
41 changes: 27 additions & 14 deletions src/scss/custom/pages/product/_product.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,39 @@
.variant {
margin-bottom: 1.5rem;

ul {
// RADIO
.radio-variants {
display: flex;
align-items: center;
flex-wrap: wrap;
row-gap: 0.5rem;
column-gap: 0.875rem;
margin-bottom: 0;

li {
&:first-of-type {
span {
margin-left: 0;
}
}
.radio-variant {
margin: 0;
}
}

.input-color {
display: none;
}
// COLORS
.color-variants {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-bottom: 0;

.color-variant {
.input-color {
display: none;
}

label {
display: block;
line-height: 0;
}

.color {
span {
font-size: 0;
.color {
margin: 0;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/catalog/_partials/miniatures/product.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

<div class="{$componentName}__infos__bottom">
{block name='product_variants'}
<div class="{$componentName}-variants">
<div class="{$componentName}__variants">
{if $product.main_variants}
{include file='catalog/_partials/variant-links.tpl' variants=$product.main_variants}
{/if}
Expand Down
12 changes: 6 additions & 6 deletions templates/catalog/_partials/product-variants.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
{/foreach}
</select>
{elseif $group.group_type == 'color'}
<ul id="group_{$id_attribute_group}" class="d-flex">
<ul id="group_{$id_attribute_group}" class="color-variants">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li>
<li class="color-variant">
<label aria-label="{$group_attribute.name}">
<input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}>
<span
Expand All @@ -41,12 +41,12 @@
{/foreach}
</ul>
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
<ul id="group_{$id_attribute_group}" class="radio-variants">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container">
<li class="radio-variant form-check">
<label>
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
<input class="form-check-input input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="form-check-label radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
Expand Down

0 comments on commit 0ef2d0f

Please sign in to comment.