Skip to content

Commit a82bbd8

Browse files
authored
Merge pull request #119 from libgit2/ethomson/search
Add search capabilities
2 parents 8d16510 + 166beb5 commit a82bbd8

File tree

7 files changed

+518
-1
lines changed

7 files changed

+518
-1
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

css/api.css

Lines changed: 179 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* API Page */
22

3+
.search h3,
34
.version h3,
45
.group h3,
56
.api h3 {
@@ -37,6 +38,7 @@
3738
padding: 0 0.4rem 0 0.5rem;
3839
}
3940

41+
.searchHeader,
4042
.apiHeader,
4143
.groupHeader,
4244
.versionHeader {
@@ -49,19 +51,71 @@
4951
margin-top: 0.2rem;
5052
}
5153

54+
.headerSearchArea {
55+
position: relative;
56+
text-align: right;
57+
margin-right: 2.0rem;
58+
}
59+
.headerSearchBox {
60+
border: solid 1px #c2c0b8;
61+
border-radius: 0.3rem;
62+
padding: 0.25rem 0.5rem;
63+
margin-bottom: 0.15rem;
64+
text-align: left;
65+
}
66+
.headerSearchResults {
67+
position: absolute;
68+
top: 1.67rem;
69+
left: 0;
70+
border: solid 1px #c2c0b8;
71+
background-color: #f8f7f0; /* #f0efe7; */
72+
text-align: left;
73+
visibility: hidden;
74+
width: 250px;
75+
}
76+
.headerSearchResultsError {
77+
background-color: rgba(241, 78, 50, 0.15);
78+
padding: 0.25rem 0.5rem;
79+
}
80+
.headerSearchResultsLoading {
81+
padding: 0.25rem 0.5rem;
82+
}
83+
.headerSearchResults ul {
84+
list-style-type: none;
85+
padding: 0;
86+
margin: 0;
87+
}
88+
.headerSearchResults ul li {
89+
padding: 0.25rem 0.5rem;
90+
margin: 0;
91+
display: block;
92+
border-bottom: solid 1px #e2e0d8;
93+
}
94+
.headerSearchResults ul li:last-of-type {
95+
border-bottom: none;
96+
}
97+
.headerSearchResults ul li a {
98+
display: inline-block;
99+
width: 100%;
100+
height: 100%;
101+
color: #666666;
102+
}
103+
104+
.searchHeaderVersionSelect,
52105
.apiHeaderVersionSelect,
53106
.groupHeaderVersionSelect,
54107
.versionHeaderVersionSelect {
55-
flex-grow: 1000;
56108
display: flex;
57109
}
110+
.searchHeaderVersionSelect span,
58111
.apiHeaderVersionSelect span,
59112
.groupHeaderVersionSelect span,
60113
.versionHeaderVersionSelect span {
61114
margin-right: 0.75rem;
62115
flex-basis: 100%;
63116
text-align: right;
64117
}
118+
.searchHeaderVersionSelect select,
65119
.apiHeaderVersionSelect select,
66120
.groupHeaderVersionSelect select,
67121
.versionHeaderVersionSelect select {
@@ -73,6 +127,7 @@
73127
margin-left: auto;
74128
}
75129

130+
.searchName,
76131
.apiName,
77132
.groupName,
78133
.versionName {
@@ -82,7 +137,9 @@
82137
font-size: 2.0rem;
83138
margin: 0.5rem 0 0 0;
84139
text-rendering: optimizelegibility;
140+
flex-grow: 1000;
85141
}
142+
.searchName,
86143
.versionName {
87144
font-family: "adelle", Georgia, "Times New Roman", serif;
88145
font-weight: 400;
@@ -555,6 +612,7 @@
555612
margin-bottom: 1.5rem;
556613
}
557614

615+
.search h3,
558616
.version h3 {
559617
text-transform: uppercase;
560618
color: #007a83;
@@ -563,6 +621,126 @@
563621
margin-top: 0.75rem;
564622
}
565623

624+
.searchSearchBox input {
625+
border: solid 1px #c2c0b8;
626+
border-radius: 0.3rem;
627+
padding: 0.25rem 0.5rem;
628+
margin-top: 1rem;
629+
margin-bottom: 0.15rem;
630+
width: 35rem;
631+
text-align: left;
632+
}
633+
.searchSearchBox button {
634+
font-size: 0.9rem;
635+
padding: 0.25rem 0.5rem;
636+
margin-left: 0.3rem;
637+
margin-bottom: 0.15rem;
638+
}
639+
640+
.searchResultsArea h3 {
641+
margin-top: 1.5rem;
642+
}
643+
.searchResults {
644+
background-color: rgba(255, 255, 255, 0.98);
645+
border: solid 1px #e2e0d8;
646+
border-radius: 0.3rem;
647+
padding: 0;
648+
margin: 0;
649+
}
650+
.searchResultsEmpty,
651+
.searchResultsError {
652+
padding: 0.75rem 1.25rem;
653+
}
654+
.searchResults ul.searchApis {
655+
padding: 0;
656+
margin: 0;
657+
}
658+
.searchResults ul.searchApis li {
659+
list-style-type: none;
660+
display: flex;
661+
}
662+
.searchResults ul.searchApis li .searchResultName {
663+
color: #f14e32;
664+
font-family: Monaco, Courier, monospace;
665+
float: left;
666+
}
667+
.searchResults ul.searchApis li:hover {
668+
background-color: #f9f9f9;
669+
}
670+
.searchResults ul.searchApis li:first-of-type:hover {
671+
border-radius: 0.25em 0.25em 0 0;
672+
}
673+
.searchResults ul.searchApis li:last-of-type:hover {
674+
border-radius: 0 0 0.25em 0.25em;
675+
}
676+
.searchResults ul.searchApis li a:hover .searchResultName {
677+
text-decoration: underline;
678+
}
679+
.searchResults ul.searchApis li .searchResultKind {
680+
display: inline;
681+
text-transform: uppercase;
682+
color: rgba(0, 122, 131, 0.90);
683+
line-height: 1.5rem;
684+
font-size: 0.7rem;
685+
font-weight: 600;
686+
margin-left: 1rem;
687+
float: left;
688+
}
689+
.searchResults ul.searchApis li .searchResultDescription {
690+
clear: both;
691+
color: #6b5d52;
692+
}
693+
.searchResults ul.searchApis li a {
694+
display: block;
695+
width: 100%;
696+
margin: 0;
697+
padding: 0.75rem 1.25rem;
698+
border-bottom: solid 1px rgb(240, 239, 231);
699+
}
700+
.searchResults ul.searchApis li p:last-of-type {
701+
margin-bottom: 0;
702+
}
703+
.searchResults ul.searchApis li:last-of-type a {
704+
border-bottom: none;
705+
}
706+
707+
.searchResults .searchPagesArea {
708+
display: flex;
709+
margin: 1.25rem 0 1rem 0;
710+
}
711+
.searchResults .searchPagesPrompt {
712+
padding: 0.4rem 0;
713+
display: none;
714+
}
715+
.searchResults ul.searchPages {
716+
list-style-type: none;
717+
padding: 0;
718+
margin: 0 auto;
719+
}
720+
.searchResults ul.searchPages li {
721+
display: inline-block;
722+
text-align: middle;
723+
border: solid 1px rgba(0, 0, 0, 0);
724+
margin: 0 0.1rem;
725+
}
726+
.searchResults ul.searchPages li a {
727+
display: inline-block;
728+
padding: 0.4rem 0.5rem;
729+
width: 100%;
730+
height: 100%;
731+
color: #666666;
732+
}
733+
.searchResults ul.searchPages li:hover {
734+
border: solid 1px #cccccc;
735+
border-radius: 0.25em;
736+
}
737+
.searchResults ul.searchPages li.searchPageCurrent {
738+
background-color: #f5f5f5;
739+
border: solid 1px #cccccc;
740+
color: #000000;
741+
border-radius: 0.25em;
742+
}
743+
566744
ul.versionIndexStandard,
567745
ul.versionIndexSystem {
568746
background-color: rgba(255, 255, 255, 0.98);

js/markdown-it.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/minisearch.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)