Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7da22e6

Browse files
committed
chore(docs): improve layout of search results
The API section now uses a multi-column list. This preserves the actual order of items. Note that only browser that support @supports and columns get the new behavior. The line-breaking behavior of search results is also improved. Previously, long words would break onto new lines or run into the second column.
1 parent 92bdd76 commit 7da22e6

File tree

2 files changed

+91
-6
lines changed

2 files changed

+91
-6
lines changed

docs/app/assets/css/docs.css

+86-1
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,13 @@ iframe.example {
315315
color:white;
316316
}
317317

318+
.search-results-group .search-results {
319+
padding: 0 5px 0;
320+
list-style-type: none;
321+
}
322+
318323
.search-results-frame > .search-results-group:first-child > .search-results {
319-
border-right:1px solid #050505;
324+
border-right:1px solid #222;
320325
}
321326

322327
.search-results-group.col-group-api { width:30%; }
@@ -325,10 +330,57 @@ iframe.example {
325330
.search-results-group.col-group-misc,
326331
.search-results-group.col-group-error { width:15%; float: right; }
327332

333+
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
334+
.search-results-group.col-group-api .search-results {
335+
-moz-column-count: 2;
336+
-ms-column-count: 2;
337+
-webkit-column-count: 2;
338+
column-count: 2;
339+
/* Prevent bullets in the second column from being hidden in Chrome and IE */
340+
-webkit-column-gap: 2em;
341+
-ms-column-gap: 2em;
342+
column-gap: 2em;
343+
}
344+
}
345+
346+
.search-results-group .search-result {
347+
word-wrap: break-word;
348+
-webkit-hyphens: auto;
349+
-moz-hyphens: auto;
350+
-ms-hyphens: auto;
351+
hyphens: auto;
352+
-ms-column-break-inside: avoid;
353+
-webkit-column-break-inside: avoid;
354+
-moz-column-break-inside: avoid; /* Unsupported */
355+
column-break-inside: avoid;
356+
text-indent: -0.65em; /* Make sure line wrapped words are aligned vertically */
357+
}
358+
359+
@supports (-moz-column-count: 2) {
360+
.search-results-group .search-result {
361+
/* Prevents column breaks inside words in FF, but has adverse effects in IE11 and Chrome */
362+
overflow: hidden;
363+
padding-left: 1em; /* In FF the list item bullet is otherwise hidden */
364+
margin-left: -1em; /* offset the padding left */
365+
}
366+
}
367+
368+
.search-result:before {
369+
content: "\002D\00A0"; /* Dash and non-breaking space as List item type */
370+
position: relative;
371+
}
328372

329373
.search-results-group.col-group-api .search-result {
330374
width:48%;
331375
display:inline-block;
376+
padding-left: 12px;
377+
}
378+
379+
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
380+
.search-results-group.col-group-api .search-result {
381+
width:auto;
382+
display: list-item;
383+
}
332384
}
333385

334386
.search-close {
@@ -682,21 +734,54 @@ ul.events > li {
682734
padding-bottom:60px;
683735
text-align:left;
684736
}
737+
738+
.search-results-frame > .search-results-group:first-child > .search-results {
739+
border-right: none;
740+
}
741+
685742
.search-results-group {
686743
float:none!important;
687744
display:block!important;
688745
width:auto!important;
689746
border:0!important;
690747
padding:0!important;
691748
}
749+
750+
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
751+
.search-results-group .search-results {
752+
-moz-column-count: 2;
753+
-ms-column-count: 2;
754+
-webkit-column-count: 2;
755+
column-count: 2;
756+
}
757+
}
758+
692759
.search-results-group .search-result {
693760
display:inline-block!important;
694761
padding:0 5px;
695762
width:auto!important;
763+
text-indent: initial;
764+
margin-left: 0;
696765
}
766+
697767
.search-results-group .search-result:after {
698768
content:", ";
699769
}
770+
771+
.search-results-group .search-result:before {
772+
content: "";
773+
}
774+
775+
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
776+
.search-results-group .search-result {
777+
display: list-item !important;
778+
}
779+
780+
.search-results-group .search-result:after {
781+
content: "";
782+
}
783+
}
784+
700785
#wrapper {
701786
padding-bottom:0px;
702787
}

docs/config/templates/indexPage.template.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@
149149
<div class="search-results-frame">
150150
<div ng-repeat="(key, value) in results" class="search-results-group" ng-class="colClassName + ' col-group-' + key">
151151
<h4 class="search-results-group-heading">{{ key }}</h4>
152-
<div class="search-results">
153-
<div ng-repeat="item in value" class="search-result">
154-
- <a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a>
155-
</div>
156-
</div>
152+
<ul class="search-results">
153+
<!-- Do not insert a line break between li and a. Chrome will insert an actual line-break, which breaks the list item view.
154+
TODO: use a html minifier instead -->
155+
<li ng-repeat="item in value" class="search-result"><a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a></li>
156+
</ul>
157157
</div>
158158
</div>
159159
<a href="" ng-click="hideResults()" class="search-close">

0 commit comments

Comments
 (0)