Skip to content

Commit 420af97

Browse files
authored
feat: Sticky Breadcrumbs
Resolves #237
1 parent df61fd4 commit 420af97

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

src/css/breadcrumbs.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
.breadcrumbs-container {
2+
padding-top: 2rem;
3+
}
4+
15
.breadcrumbs {
2-
margin: 2.5rem 0 0;
36
max-width: var(--doc-max-width);
47
flex: 1 1;
58
padding: 0;
@@ -14,6 +17,20 @@
1417
max-width: var(--doc-max-width--desktop);
1518
min-width: 0;
1619
}
20+
.breadcrumbs-container {
21+
position: fixed;
22+
top: 80px;
23+
padding: 1rem 0;
24+
right: var(--toc-width--widescreen);
25+
left: var(--nav-width);
26+
margin-left: 3rem;
27+
margin-right: 3rem;
28+
background-color: var(--body-background-color);
29+
border-bottom: 1px solid var(--nav-panel-divider-color);
30+
}
31+
.doc {
32+
padding-top: 60px;
33+
}
1734
}
1835

1936
a + .breadcrumbs {

src/partials/breadcrumbs.hbs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
<nav class="breadcrumbs" aria-label="breadcrumbs">
2-
{{#if page.breadcrumbs}}
3-
<ul>
4-
{{#with page.componentVersion}}
5-
{{#if (and ./title (ne ./title @root.page.breadcrumbs.0.content))}}
6-
<li><a href="{{{relativize ./url}}}">{{{./title}}}</a></li>
1+
<div class="breadcrumbs-container">
2+
<nav class="breadcrumbs" aria-label="breadcrumbs">
3+
{{#if page.breadcrumbs}}
4+
<ul>
5+
{{#with page.componentVersion}}
6+
{{#if (and ./title (ne ./title @root.page.breadcrumbs.0.content))}}
7+
<li><a href="{{{relativize ./url}}}">{{{./title}}}</a></li>
8+
{{/if}}
9+
{{/with}}
10+
{{#each page.breadcrumbs}}
11+
<li>
12+
{{~#if (and ./url (eq ./urlType 'internal'))~}}
13+
<a href="{{{relativize ./url}}}">{{{./content}}}</a>
14+
{{~else~}}
15+
{{{./content}}}
16+
{{~/if~}}
17+
</li>
18+
{{/each}}
19+
</ul>
720
{{/if}}
8-
{{/with}}
9-
{{#each page.breadcrumbs}}
10-
<li>
11-
{{~#if (and ./url (eq ./urlType 'internal'))~}}
12-
<a href="{{{relativize ./url}}}">{{{./content}}}</a>
13-
{{~else~}}
14-
{{{./content}}}
15-
{{~/if~}}
16-
</li>
17-
{{/each}}
18-
</ul>
19-
{{/if}}
20-
</nav>
21+
</nav>
22+
</div>

0 commit comments

Comments
 (0)