Skip to content

Commit

Permalink
feat: Sticky Breadcrumbs
Browse files Browse the repository at this point in the history
Resolves #237
  • Loading branch information
oodamien authored May 9, 2024
1 parent df61fd4 commit 420af97
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
19 changes: 18 additions & 1 deletion src/css/breadcrumbs.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.breadcrumbs-container {
padding-top: 2rem;
}

.breadcrumbs {
margin: 2.5rem 0 0;
max-width: var(--doc-max-width);
flex: 1 1;
padding: 0;
Expand All @@ -14,6 +17,20 @@
max-width: var(--doc-max-width--desktop);
min-width: 0;
}
.breadcrumbs-container {
position: fixed;
top: 80px;
padding: 1rem 0;
right: var(--toc-width--widescreen);
left: var(--nav-width);
margin-left: 3rem;
margin-right: 3rem;
background-color: var(--body-background-color);
border-bottom: 1px solid var(--nav-panel-divider-color);
}
.doc {
padding-top: 60px;
}
}

a + .breadcrumbs {
Expand Down
40 changes: 21 additions & 19 deletions src/partials/breadcrumbs.hbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<nav class="breadcrumbs" aria-label="breadcrumbs">
{{#if page.breadcrumbs}}
<ul>
{{#with page.componentVersion}}
{{#if (and ./title (ne ./title @root.page.breadcrumbs.0.content))}}
<li><a href="{{{relativize ./url}}}">{{{./title}}}</a></li>
<div class="breadcrumbs-container">
<nav class="breadcrumbs" aria-label="breadcrumbs">
{{#if page.breadcrumbs}}
<ul>
{{#with page.componentVersion}}
{{#if (and ./title (ne ./title @root.page.breadcrumbs.0.content))}}
<li><a href="{{{relativize ./url}}}">{{{./title}}}</a></li>
{{/if}}
{{/with}}
{{#each page.breadcrumbs}}
<li>
{{~#if (and ./url (eq ./urlType 'internal'))~}}
<a href="{{{relativize ./url}}}">{{{./content}}}</a>
{{~else~}}
{{{./content}}}
{{~/if~}}
</li>
{{/each}}
</ul>
{{/if}}
{{/with}}
{{#each page.breadcrumbs}}
<li>
{{~#if (and ./url (eq ./urlType 'internal'))~}}
<a href="{{{relativize ./url}}}">{{{./content}}}</a>
{{~else~}}
{{{./content}}}
{{~/if~}}
</li>
{{/each}}
</ul>
{{/if}}
</nav>
</nav>
</div>

0 comments on commit 420af97

Please sign in to comment.