-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from thelia/feat/breadcrumb-group
feat: breadcrumb group
- Loading branch information
Showing
4 changed files
with
105 additions
and
38 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const breadcrumbFunction = () => { | ||
const btnCompressed = document.querySelector('.Breadcrumb-compressed'); | ||
const liCompressed = document.getElementById('Breadcrumb-compressed'); | ||
const items = document.querySelectorAll(".Breadcrumb-item"); | ||
|
||
if (btnCompressed) { | ||
btnCompressed.addEventListener('click', function () { | ||
items.forEach(function (item) { | ||
item.classList.remove("hide") | ||
}); | ||
liCompressed.classList.add("hide") | ||
}) | ||
}; | ||
} | ||
|
||
export default breadcrumbFunction; |
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
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,14 +1,29 @@ | ||
{% set classes = '' %} | ||
{% if compressed %} | ||
{% set classes = classes ~ ' Breadcrumb--compressed' %} | ||
{% endif %} | ||
|
||
{% if href %} | ||
<a class="Breadcrumb{{ classes }}" href="{{ href }}"> | ||
{{ compressed ? '...' : customText }} | ||
</a> | ||
{% else %} | ||
<span class="Breadcrumb{{ classes }}"> | ||
{{ compressed ? '...' : customText }} | ||
</span> | ||
{% endif %} | ||
<nav class="Breadcrumb{{ classes }}" aria-label="Fil d'Ariane"> | ||
<ol class="Breadcrumb-list" itemscope itemtype="https://schema.org/BreadcrumbList"> | ||
{% if items.length > 3 %} | ||
<li id="Breadcrumb-compressed" class="Breadcrumb-item Breadcrumb-item--isLink"> | ||
<button class="Breadcrumb-item-link Breadcrumb-compressed">...</button> | ||
</li> | ||
{% endif %} | ||
|
||
{% for item in items %} | ||
<li class="Breadcrumb-item{% if item.href %} Breadcrumb-item--isLink{% endif %}{% if loop.index <= (items.length - 3) %} hide{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> | ||
{% if item.href %} | ||
<a class="Breadcrumb-item-link" href="{{ item.href }}" itemprop="item"> | ||
<span itemprop="name">{{ item.label }}</span> | ||
</a> | ||
<meta itemprop="position" content="{{ loop.index + 1 }}" /> | ||
{% else %} | ||
<span itemProp="name" aria-current="page"> | ||
{{ item.label }} | ||
</span> | ||
<meta itemprop="position" content="{{ loop.index + 1 }}" /> | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
</nav> | ||
|
||
|
||
|
||
|
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