Skip to content

Commit af68417

Browse files
isaaccloosseanmonstar
authored andcommitted
fix(site): make navbar visible on mobile (#3216)
Installation guides: bootstrap: https://getbootstrap.com/docs/5.2/getting-started/introduction/ component: https://getbootstrap.com/docs/5.2/components/navbar/ Updating bootstrap and adding the js dependency has greatly increased the site size. Cold visit went from ~20kb to ~70kb. Something to bear in mind with these additions.
1 parent 783651b commit af68417

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

_includes/footer.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@
1717
</div>
1818
</footer>
1919
<script src="{{ "/js/rustdoc.js" | absolute_url }}"></script>
20+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"
21+
integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
22+
crossorigin="anonymous"></script>

_includes/header.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<header class="navbar navbar-expand-lg navbar-hyper" role="navigation">
22
<nav class="container">
3-
<div class="collapse navbar-collapse">
4-
<ul class="nav navbar-nav">
5-
<li class="nav-item">
6-
<a class="navbar-brand" href="/">hyper.rs</a>
7-
</li>
3+
<a class="navbar-brand" href="/">hyper.rs</a>
4+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#hyperNavbar">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
<div class="collapse navbar-collapse" id="hyperNavbar">
8+
<ul class="navbar-nav">
89
<li class="nav-item"><a class="nav-link" href="/guides/1">1.0 Guides</a></li>
910
<li class="nav-item"><a class="nav-link" href="/guides/0.14">0.14 Guides</a></li>
1011
<li class="nav-item"><a class="nav-link" href="/contrib">Contrib</a></li>

css/main.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ pre code {
7777
text-transform: lowercase;
7878
}
7979

80+
@media (min-width: 992px) {
81+
#hyper .nav-link {
82+
line-height: 3rem;
83+
}
84+
}
85+
8086
#hyper .navbar a:hover, #hyper .navbar a:focus {
8187
background: none;
8288
border-color: $primary-highlight-color;

0 commit comments

Comments
 (0)