-
Notifications
You must be signed in to change notification settings - Fork 921
/
Subnav.astro
83 lines (71 loc) · 1.45 KB
/
Subnav.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
const { title, inputPath, headers } = Astro.props;
---
<style lang="scss">
@use "../../public/styles/var" as *;
.header {
margin-top: 0;
margin-bottom: 8px;
color: rgba($white, 0.6);
font-weight: 600;
font-size: 20px;
font-family: $heading;
line-height: 1.2;
@media (min-width: $breakpoint-m) {
color: $dark-grey;
}
}
.subnav {
position: static;
z-index: 1;
padding: 2rem 0 24px 0;
@media (min-width: 1240px) {
position:-webkit-sticky;
position: sticky;
top: 56px;
z-index: 1;
display: block;
max-height: calc(100vh - 56px);
color: inherit;
background: none;
-webkit-overflow-scrolling: touch;
}
.header {
color: $dark-grey;
}
hr {
display: block;
height: 1px;
margin: 1rem 0;
background-color: $light-grey;
border: none;
appearance: none;
}
ol {
margin: 0;
padding: 0;
list-style: none;
}
a {
color: $grey;
}
}
</style>
<script type="module" defer src="/js/index.js"></script>
<aside class="subnav">
{headers.length > 0 && (
<div>
<h4 class="header">On this page</h4>
<nav class="toc">
<ol>
{headers.map((heading) => {
return <li><a href={"#" + heading.slug}>{heading.text}</a></li>
})}
</ol>
</nav>
<hr />
</div>
)}
<h4 class="header">Suggest a change</h4>
<a href="https://github.com/snowpackjs/snowpack/blob/main/docs">Edit this page on GitHub</a>
</aside>