Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Commit

Permalink
WIP – refactored search view
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Feb 21, 2015
1 parent a3fad93 commit d7406b3
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 37 deletions.
4 changes: 2 additions & 2 deletions assets/css/uno.css

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions assets/js/src/search.coffee
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
'use strict'

showSearch = ->
$(".content-wrapper__inner").hide()
$('#search-results').css "margin-top", "3rem"
$('#search-results').css "margin-bottom", "9rem"
$ ->
showSearch = ->
$(".content").hide()
$('#search-results').addClass('active')

hideSearch = ->
$(".content-wrapper__inner").show()
$('#search-results').css "padding-top", "0"
$('#search-results').css "margin-bottom", "0"
hideSearch = ->
$(".content").show()
$('#search-results').removeClass('active')

$ ->
$("#search-field").ghostHunter
results : "#search-results"
zeroResultsInfo : false
onKeyUp : true
displaySearchInfo : true
onComplete : (query) ->
result_template :
"""
<a class="result" href='{{link}}'>
<h2>{{title}}</h2>
<h4>{{pubDate}}</h4>
</a>
"""
onComplete : (query) ->
if query.length > 0 then showSearch() else hideSearch()
6 changes: 3 additions & 3 deletions assets/js/uno.js

Large diffs are not rendered by default.

57 changes: 37 additions & 20 deletions assets/scss/components/_search.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#search {
#search-form {
padding: .25rem 0;
}

Expand All @@ -9,30 +9,47 @@
border: 1.5px solid lighten($hover-color, 5%);
border-radius: 27px;
}
.icon-search {
position: relative;
top: 2px;
left: 13rem;
color: #bbb;
}

#search-results {
text-align: center;
&.active {
margin-top: 3rem;
margin-bottom: 9rem;
}

> p {
margin-bottom: 3rem;
font-size: 1.4rem;
color: #bbb;
font-size: 1.2rem;
}
}

.result {
> h2,
> h4 {
color: $gray-darker;
}
a {
display: block;
padding: 1em 2.5%;
margin-bottom: 1.3rem;
text-decoration: none;
word-wrap: break-word;
background-color: none;
border: 1px solid #d9d9d9;
&:hover {
background-color: #f5f5f5;
transition: 0s;

display: block;
padding: 1em 2.5%;
margin-bottom: 1.3rem;
text-decoration: none;
word-wrap: break-word;
border: 1px solid $primary-color;
border-radius: 5px;
&:hover {
transition: .5s;
> h2,
> h4 {
color: $hover-color;
transition: .5s;
}
}
}

.icon-search {
position: relative;
top: 2px;
left: 13rem;
color: $gray;
text-shadow: 1px 1px 0 $gray;
}
2 changes: 1 addition & 1 deletion gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ gulp.task 'css', ->
gulp.src src.css.vendor
.pipe changed dist.css
.pipe addsrc src.sass.main
.pipe sass()
.pipe sass().on "error", gutil.log
.pipe concat 'uno.css'
.pipe prefix()
.pipe strip
Expand Down
2 changes: 1 addition & 1 deletion partials/search.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section id="search-container">
<form id="search">
<form id="search-form">
<i class="icon icon-search"></i>
<input type="text", name="search", placeholder="git, css, javascript,..." id="search-field" />
</form>
Expand Down

0 comments on commit d7406b3

Please sign in to comment.