Skip to content

Commit 89ee7b4

Browse files
authored
Merge pull request #665 from shieldsjared/github-issue-630
Added a search box to the nav header for the mobile view.
2 parents f24869b + 25a5bf0 commit 89ee7b4

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

source/myscript.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
$(document).ready(function(){
22

33
$('header .links__icon').on('click', function (){
4-
$(this).next().slideToggle();
4+
$("header .header__searchbar").hide();
5+
$("header .header__links").slideToggle();
6+
});
7+
8+
$('header .search__icon').on('click', function (){
9+
$("header .header__links").hide();
10+
$("header .header__searchbar").slideToggle(400, function() {
11+
if($(this).is(':visible')) {
12+
$(this).find("input[type=text]").focus();
13+
}
14+
});
515
});
616

717
if($('.wy-menu-vertical li.current>a').length){

source/templates/header.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<header>
22
<div class="header__container">
3+
<div class="search__icon">
4+
<i class="fa fa-search"></i>
5+
</div>
36
<a href="http://docs.mattermost.com/" class="header__logo">
47
<img width="176" src="https://about.mattermost.com/wp-content/uploads/2016/01/logo.png">
58
</a>
@@ -14,5 +17,12 @@
1417
<li><a href="https://about.mattermost.com/contact/">Contact</a></li>
1518
<li><a href="https://www.mattermost.org/download/">Download</a></li>
1619
</ul>
20+
<div class="header__searchbar">
21+
<form id="rtd-search-form" class="wy-form" action="{{ pathto('search') }}" method="get">
22+
<input type="text" name="q" placeholder="Search by keyword" autofocus />
23+
<input type="hidden" name="check_keywords" value="yes" />
24+
<input type="hidden" name="area" value="default" />
25+
</form>
26+
</div>
1727
</div>
1828
</header>

source/theme.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ header .links__icon {
210210
position: relative;
211211
}
212212

213+
header .search__icon {
214+
cursor: pointer;
215+
display: none;
216+
float: left;
217+
font-size: 20px;
218+
padding: 0 20px;
219+
position: relative;
220+
}
221+
213222
.wy-nav-top {
214223
background: #F5F5F5;
215224
padding: 0 10px;
@@ -279,13 +288,23 @@ header .header__links li a {
279288
border-top: 3px solid transparent;
280289
}
281290

291+
header .header__searchbar {
292+
display: none;
293+
float: left;
294+
padding: 0 5px 0 0;
295+
}
296+
282297
@media (max-width: 768px){
298+
<<<<<<< HEAD
283299
header .links__icon {
284300
display: block;
285301
}
286302
.wy-nav-top {
287303
display: none;
288304
}
305+
=======
306+
307+
>>>>>>> c8fd417... Added a search box to the nav header for the mobile view.
289308
.wy-side-nav-search {
290309
position: relative;
291310
}
@@ -299,9 +318,41 @@ header .header__links li a {
299318
.wy-nav-content-wrap.shift {
300319
top: 70px;
301320
}
321+
header .header__container {
322+
text-align:center;
323+
}
324+
header .links__icon {
325+
display: block;
326+
}
327+
header .search__icon {
328+
display: block;
329+
}
330+
header .header__logo {
331+
position: relative;
332+
margin-left: auto;
333+
margin-right: auto;
334+
float:none;
335+
}
302336
header .header__logo img {
303337
width: 176px;
304338
}
339+
header .header__searchbar {
340+
border-bottom: 1px solid #ccc;
341+
display: none;
342+
background: #fff;
343+
line-height: 40px;
344+
padding: 0 15px 5px;
345+
width: 100%;
346+
}
347+
header .header__searchbar input[type="text"] {
348+
width: 100%;
349+
border-radius: 50px;
350+
border: 1px solid #ddd;
351+
padding: 6px 12px;
352+
}
353+
header .header__searchbar input:focus {
354+
outline: none;
355+
}
305356
header .header__links {
306357
border-bottom: 1px solid #ccc;
307358
display: none;

0 commit comments

Comments
 (0)