Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 5fc4b73

Browse files
committed
2 parents db472c7 + f0f22b0 commit 5fc4b73

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

  • packages
    • telescope-search/lib/client/views
    • telescope-theme-hubble/lib/client/scss/modules

packages/telescope-search/lib/client/views/search.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ Meteor.startup(function () {
2525
'keyup, search .search-field': function(e){
2626
e.preventDefault();
2727
var val = $(e.target).val(),
28-
$search = $('.search');
29-
if(val==''){
30-
// if search field is empty, just do nothing and show an empty template
28+
$search = $('.search');
29+
if (val === '') {
30+
// if search field is empty, just do nothing and show an empty template
3131
$search.addClass('empty');
3232
Session.set('searchQuery', '');
3333
Router.go('/search', null, {replaceState: true});
34-
}else{
35-
// if search field is not empty, add a delay to avoid firing new searches for every keystroke
34+
} else {
35+
$search.removeClass('empty');
36+
// if search field is not empty, add a delay to avoid firing new searches for every keystroke
3637
delay(function(){
3738
Session.set('searchQuery', val);
38-
$search.removeClass('empty');
3939

4040
// Update the querystring.
4141
var opts = {query: 'q=' + encodeURIComponent(val)};

packages/telescope-theme-hubble/lib/client/scss/modules/_nav.scss

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,40 +84,43 @@
8484
}
8585
}
8686

87-
.search{
87+
.search {
88+
$compressed-width: 120px;
89+
$expanded-width: 200px;
90+
8891
position: relative;
89-
.search-field{
92+
.search-field {
9093
font-size: 14px;
9194
padding: 4px 12px;
9295
line-height: 1.3;
9396
border-radius: 20px;
9497
border: 0px;
95-
width: 120px;
96-
-webkit-appearance: textfield;
97-
-webkit-transition: 0.2s all;
98-
-moz-transition: 0.2s all;
98+
width: $expanded-width;
99+
transition: 0.2s all;
99100
-webkit-appearance: textfield;
100101
background: white;
101-
&:focus{
102-
outline:none;
102+
&:focus {
103+
outline: none;
103104
}
104105
}
105-
&.empty{
106-
.search-field{
106+
&.empty {
107+
.search-field {
108+
width: $compressed-width;
107109
background: white(0.1);
108-
&:focus{
110+
&:focus {
109111
background: white;
112+
width: $expanded-width;
110113
}
111114
}
112115
}
113116
}
114117

115118
.has-dropdown .user-menu .dropdown-menu{
116-
left:auto;
119+
left: auto;
117120
right: 10px;
118121
}
119122
.has-dropdown .notifications-menu .dropdown-menu{
120-
left:auto;
123+
left: auto;
121124
right: 10px;
122125
}
123126
.newsletter-dismiss{

0 commit comments

Comments
 (0)