Skip to content

Commit 74b05ce

Browse files
authored
Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha
Unify search input and buttons size Fixes #93060. Here what it looks like: ![Screenshot from 2022-01-20 21-38-19](https://user-images.githubusercontent.com/3050060/150418571-fefd6538-b3ee-4dd2-b77b-77e96bcfa0ed.png) ![Screenshot from 2022-01-20 21-38-22](https://user-images.githubusercontent.com/3050060/150418570-53ba259b-9bd4-4084-8b43-d74a5752d712.png) You can test it [here](https://rustdoc.crud.net/imperio/unify-sizes/std/index.html). r? ``@jsha``
2 parents a152528 + f0525da commit 74b05ce

File tree

5 files changed

+33
-106
lines changed

5 files changed

+33
-106
lines changed

src/librustdoc/html/static/css/rustdoc.css

+19-64
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,11 @@ table,
896896

897897
.search-container {
898898
position: relative;
899-
max-width: 960px;
899+
display: flex;
900+
height: 34px;
900901
}
901-
.search-container > div {
902-
display: inline-flex;
903-
width: calc(100% - 63px);
902+
.search-container > * {
903+
height: 100%;
904904
}
905905
.search-results-title {
906906
display: inline;
@@ -931,10 +931,8 @@ table,
931931
background-position: calc(100% - 1px) 56%;
932932
background-image: /* AUTOREPLACE: */url("down-arrow.svg");
933933
}
934-
.search-container > .top-button {
935-
position: absolute;
936-
right: 0;
937-
top: 10px;
934+
.search-container {
935+
margin-top: 4px;
938936
}
939937
.search-input {
940938
/* Override Normalize.css: it has a rule that sets
@@ -947,23 +945,14 @@ table,
947945
-moz-box-sizing: border-box !important;
948946
box-sizing: border-box !important;
949947
outline: none;
950-
border: none;
951-
border-radius: 1px;
952-
margin-top: 5px;
953-
padding: 10px 16px;
948+
border: 1px solid;
949+
border-radius: 2px;
950+
padding: 5px 8px;
954951
font-size: 1.0625rem;
955952
transition: border-color 300ms ease;
956-
transition: border-radius 300ms ease-in-out;
957-
transition: box-shadow 300ms ease-in-out;
958953
width: 100%;
959954
}
960955

961-
.search-input:focus {
962-
border-radius: 2px;
963-
border: 0;
964-
outline: 0;
965-
}
966-
967956
.search-results {
968957
display: none;
969958
padding-bottom: 2em;
@@ -1436,43 +1425,36 @@ pre.rust {
14361425

14371426
.theme-picker {
14381427
position: absolute;
1439-
left: -34px;
1440-
top: 9px;
1428+
left: -38px;
1429+
top: 4px;
14411430
}
14421431

14431432
.theme-picker button {
14441433
outline: none;
14451434
}
14461435

14471436
#settings-menu, #help-button {
1448-
position: absolute;
1449-
top: 10px;
1450-
}
1451-
1452-
#settings-menu {
1453-
right: 0;
1437+
margin-left: 4px;
14541438
outline: none;
14551439
}
14561440

1441+
#theme-picker, #copy-path {
1442+
height: 34px;
1443+
}
14571444
#theme-picker, #settings-menu, #help-button, #copy-path {
1458-
padding: 4px;
1459-
/* Rare exception to specifying font sizes in rem. Since these are acting
1460-
as icons, it's okay to specify their sizes in pixels. */
1461-
font-size: 16px;
1462-
width: 27px;
1463-
height: 29px;
1445+
padding: 5px;
1446+
width: 33px;
14641447
border: 1px solid;
1465-
border-radius: 3px;
1448+
border-radius: 2px;
14661449
cursor: pointer;
14671450
}
14681451

14691452
#help-button {
1470-
right: 30px;
14711453
font-family: "Fira Sans", Arial, sans-serif;
14721454
text-align: center;
14731455
/* Rare exception to specifying font sizes in rem. Since this is acting
14741456
as an icon, it's okay to specify their sizes in pixels. */
1475-
font-size: 16px;
1457+
font-size: 20px;
14761458
padding-top: 2px;
14771459
}
14781460

@@ -1909,10 +1891,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19091891
display: none !important;
19101892
}
19111893

1912-
.theme-picker {
1913-
z-index: 1;
1914-
}
1915-
19161894
.notable-traits {
19171895
position: absolute;
19181896
left: -22px;
@@ -1999,10 +1977,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19991977
width: 100%;
20001978
}
20011979

2002-
.search-container > div {
2003-
width: calc(100% - 32px);
2004-
}
2005-
20061980
/* Display an alternating layout on tablets and phones */
20071981
.search-results > a {
20081982
border-bottom: 1px solid #aaa9;
@@ -2047,30 +2021,11 @@ details.rustdoc-toggle[open] > summary.hideme::after {
20472021
width: 50%;
20482022
}
20492023

2050-
.search-container > div {
2051-
display: block;
2052-
width: calc(100% - 37px);
2053-
}
2054-
20552024
#crate-search {
20562025
border-radius: 4px;
20572026
border: 0;
20582027
}
20592028

2060-
#theme-picker, #settings-menu {
2061-
padding: 5px;
2062-
width: 31px;
2063-
height: 31px;
2064-
}
2065-
2066-
#theme-picker {
2067-
margin-top: -2px;
2068-
}
2069-
2070-
#settings-menu {
2071-
top: 7px;
2072-
}
2073-
20742029
.docblock {
20752030
margin-left: 12px;
20762031
}

src/librustdoc/html/static/css/themes/ayu.css

+2-10
Original file line numberDiff line numberDiff line change
@@ -233,22 +233,14 @@ details.undocumented > summary::before {
233233
filter: invert(100%);
234234
}
235235

236-
#crate-search {
237-
color: #c5c5c5;
236+
#crate-search, .search-input {
238237
background-color: #141920;
239-
box-shadow: 0 0 0 1px #424c57,0 0 0 2px transparent;
240238
border-color: #424c57;
239+
color: #c5c5c5;
241240
}
242241

243242
.search-input {
244243
color: #ffffff;
245-
background-color: #141920;
246-
box-shadow: 0 0 0 1px #424c57,0 0 0 2px transparent;
247-
transition: box-shadow 150ms ease-in-out;
248-
}
249-
250-
#crate-search+.search-input:focus {
251-
box-shadow: 0 0 0 1px #148099,0 0 0 2px transparent;
252244
}
253245

254246
.module-item .stab,

src/librustdoc/html/static/css/themes/dark.css

+2-9
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,20 @@ details.undocumented > summary::before {
194194
filter: invert(100%);
195195
}
196196

197-
#crate-search {
197+
#crate-search, .search-input {
198198
color: #111;
199199
background-color: #f0f0f0;
200200
border-color: #000;
201-
box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
202201
}
203202

204203
.search-input {
205-
color: #111;
206-
background-color: #f0f0f0;
207-
box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
204+
border-color: #e0e0e0;
208205
}
209206

210207
.search-input:focus {
211208
border-color: #008dfd;
212209
}
213210

214-
#crate-search + .search-input:focus {
215-
box-shadow: 0 0 8px 4px #078dd8;
216-
}
217-
218211
.module-item .stab,
219212
.import-item .stab {
220213
color: #ddd;

src/librustdoc/html/static/css/themes/light.css

+1-12
Original file line numberDiff line numberDiff line change
@@ -186,27 +186,16 @@ details.undocumented > summary::before {
186186
color: #999;
187187
}
188188

189-
#crate-search {
189+
#crate-search, .search-input {
190190
color: #555;
191191
background-color: white;
192192
border-color: #e0e0e0;
193-
box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
194-
}
195-
196-
.search-input {
197-
color: #555;
198-
background-color: white;
199-
box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
200193
}
201194

202195
.search-input:focus {
203196
border-color: #66afe9;
204197
}
205198

206-
#crate-search + .search-input:focus {
207-
box-shadow: 0 0 8px #078dd8;
208-
}
209-
210199
.module-item .stab,
211200
.import-item .stab {
212201
color: #000;

src/librustdoc/html/templates/page.html

+9-11
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,23 @@ <h2 class="location"></h2>
110110
<nav class="sub"> {#- -#}
111111
<div class="theme-picker hidden"> {#- -#}
112112
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
113-
<img width="18" height="18" alt="Pick another theme!" {# -#}
113+
<img width="22" height="22" alt="Pick another theme!" {# -#}
114114
src="{{static_root_path|safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
115115
</button> {#- -#}
116116
<div id="theme-choices" role="menu"></div> {#- -#}
117117
</div> {#- -#}
118118
<form class="search-form"> {#- -#}
119119
<div class="search-container"> {#- -#}
120-
<div>
121-
<input {# -#}
122-
class="search-input" {# -#}
123-
name="search" {# -#}
124-
autocomplete="off" {# -#}
125-
spellcheck="false" {# -#}
126-
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
127-
type="search"> {#- -#}
128-
</div> {#- -#}
120+
<input {# -#}
121+
class="search-input" {# -#}
122+
name="search" {# -#}
123+
autocomplete="off" {# -#}
124+
spellcheck="false" {# -#}
125+
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
126+
type="search"> {#- -#}
129127
<button type="button" id="help-button" title="help">?</button> {#- -#}
130128
<a id="settings-menu" href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#}
131-
<img width="18" height="18" alt="Change settings" {# -#}
129+
<img width="22" height="22" alt="Change settings" {# -#}
132130
src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
133131
</a> {#- -#}
134132
</div> {#- -#}

0 commit comments

Comments
 (0)