So, I basically need to display the following information inline on my website: Just like this:
Family: Open Sans - Variant: Regular Italic
Size: 15px - Line Height: 25px - Paragraph: 15px
Color: grey_3
This is the code snippet:
{% include "../component/1-atom/Typographies/sg-typo-hierarchisation.twig" with {
typo_hierarchisation: [
{
title: "Family",
value: "Fira Sans",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
},
{
title: "Variant",
value: "ExtraBold",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
},
{
title: "Size",
value: "50px",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
},
{
title: "Line Height",
value: "50px",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
},
{
title: "Paragraph",
value: "25px",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
},
{
title: "Color",
value: "universe color",
value_2: "primary_ {{ universe }}",
class_regular: "fw-regular-i",
class_bold: "fw-bold-i",
}
]
}%}
Here is the content of the included file:
<ul class="sg-typo-hierarchisation">
{% for item in typo_hierarchisation %}
{% set trait = "<i class='trait'> — </i>" %}
<li class="sg-typo-hierarchisation-item">
<span class={{item.class_regdivar ? item.class_regular: ""}}>{{ item.title ? item.title : "" }}</span>
<span class={{item.class_bold}}>{{ item.value ? " : " ~ item.value : "" }}</span>
{{ item.value_2 ? ('<span class=' ~ item.class_bold ~ '>' ~ trait ~ item.value_2 ~ '</span>')|raw : '' }}
</li>
{% endfor %}
</ul>
As of now, this is how it's rendered:
Family: Fira Sans
Variant: ExtraBold
Size: 50px
Line Height: 50px
Paragraph: 25px
Color: universe color - primary_ {{ universe }}
Edit: On inspecting the website, here's the output:
<ul class="sg-typo-hierarchisation">
<li class="sg-typo-hierarchisation-item">
<span class="">Family</span>
<span class="fw-bold-i"> : Fira Sans</span>
</li>
<li class="sg-typo-hierarchisation-item">
<span class="">Variant</span>
<span class="fw-bold-i"> : ExtraBold</span>
</li>
<li class="sg-typo-hierarchisation-item">
<span class="">Size</span>
<span class="fw-bold-i"> : 50px</span>
</li>
<li class="sg-typo-hierarchisation-item">
<span class="">Line Height</span>
<span class="fw-bold-i"> : 50px</span>
</li>
<li class="sg-typo-hierarchisation-item">
<span class="">Paragraph</span>
<span class="fw-bold-i"> : 25px</span>
</li>
<li class="sg-typo-hierarchisation-item">
<span class="">Color</span>
<span class="fw-bold-i"> : universe color</span>
<span class="fw-bold-i"><i class="trait"> — </i>primary_ {{ universe }}</span>
</li>
</ul>