Skip to content

Commit 0f42199

Browse files
GuillaumeGomezJoshua Nelson
authored and
Joshua Nelson
committed
Fix top navbar resize
1 parent f6fd6cf commit 0f42199

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

templates/header/topbar_begin.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<div class="nav-container">
1010
<div class="container">
1111
<div class="pure-menu pure-menu-horizontal" role="navigation" aria-label="Main navigation">
12-
<form action="/releases/search" method="GET" class="landing-search-form-nav">
12+
<form action="/releases/search" method="GET"
13+
class="landing-search-form-nav {% if not is_latest_version %}not-latest{% endif %}">
1314
{# The search bar #}
1415
<div id="search-input-nav" class="pure-menu-right">
1516
<label for="nav-search">

templates/rustdoc/topbar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ul class="pure-menu-list">
99
{% if 'krate' in __tera_context %}
1010
<li class="pure-menu-item pure-menu-has-children">
11-
<a href="#" class="pure-menu-link" title="{{ krate.description }}">
11+
<a href="#" class="pure-menu-link crate-name" title="{{ krate.description }}">
1212
{{ "cube" | fas }}
1313
<span class="title">{{ krate.name }}-{{ krate.version }}</span>
1414
</a>
@@ -163,7 +163,7 @@
163163
</li>
164164
{% else %}
165165
<li class="pure-menu-item">
166-
<a href="{{ crate_url | safe }}" class="pure-menu-link" title="{{ metadata.description }}">
166+
<a href="{{ crate_url | safe }}" class="pure-menu-link crate-name" title="{{ metadata.description }}">
167167
{{ "cube" | fas }}
168168
<span class="title">{{ metadata.name }}-{{ metadata.version }}</span>
169169
</a>

templates/style/_navbar.scss

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ div.nav-container {
4343
color: var(--color-standard);
4444
background-color: inherit;
4545
}
46+
47+
&.crate-name {
48+
text-overflow: ellipsis;
49+
overflow: hidden;
50+
max-width: 200px;
51+
}
4652
}
4753

4854
.pure-menu-right {
@@ -121,11 +127,38 @@ div.nav-container {
121127
// use a .title span inside a menu to hide it on small screens
122128
span.title {
123129
display: none;
124-
@media #{$media-sm} {
130+
@media screen and (min-width: 872px) {
131+
display: inline;
132+
}
133+
}
134+
135+
.pure-menu-right span.title {
136+
@media screen and (min-width: 872px) {
137+
display: none;
138+
}
139+
@media screen and (min-width: 965px) {
125140
display: inline;
126141
}
127142
}
128143

144+
form.landing-search-form-nav.not-latest {
145+
span.title {
146+
display: none;
147+
@media screen and (min-width: 973px) {
148+
display: inline;
149+
}
150+
}
151+
152+
.pure-menu-right span.title {
153+
@media screen and (min-width: 973px) {
154+
display: none;
155+
}
156+
@media screen and (min-width: 1125px) {
157+
display: inline;
158+
}
159+
}
160+
}
161+
129162
// Make menu item optional and disappear on small screens
130163
.pure-menu-opt {
131164
display: none;

0 commit comments

Comments
 (0)