Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeahead Tweaks #65

Merged
merged 2 commits into from Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions layouts/partials/footer.ejs
Expand Up @@ -78,8 +78,8 @@
if (xhr.status !== 200) return; // if ajax fails, continue with old listing

var lastFetched = new Date().getTime()
var uniqueNames = new $.unique(data.filenames)
var data = {lastFetched: lastFetched, filenames: uniqueNames}
var uniqueNames = new Set(data.filenames)
var data = {lastFetched: lastFetched, filenames: Array.from(uniqueNames)}
localStorage.setItem('filenames', JSON.stringify(data))
})
}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/search.ejs
Expand Up @@ -3,7 +3,7 @@
<% const placeholder = template('search.placeholder')%>
<% const focus = locals.focus || '' %>
<% const msgOnFocus = placeholder || '' %>
<input <%= focus %> id="search-box" type="text" name="q" value="<%= locals.q %>" placeholder="<%- placeholder %>" />
<input <%= focus %> id="search-box" class="twitter-typeahead" type="text" name="q" value="<%= locals.q %>" placeholder="<%- placeholder %>" />
<button class="icon"><i class="fa fa-search"></i></button>
</form>

Expand Down
4 changes: 4 additions & 0 deletions styles/partials/core/_base.scss
Expand Up @@ -28,6 +28,10 @@ a {

}

input {
box-sizing: border-box;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lack of a css reset has messed with me a number of times — maybe we should consider adding some extremely simple resets?

}

// Tables
table {
border-collapse: collapse;
Expand Down
47 changes: 26 additions & 21 deletions styles/partials/core/_furniture.scss
Expand Up @@ -155,10 +155,14 @@
}

.twitter-typeahead {
position: absolute;
font-style: normal;
font-family: $font-sans;
font-size: 16px;
line-height: 30px;
font-weight: 400;
position: relative;
width: calc(100% - 65px);
height: 50px;
border-radius: 0;
background-color: transparent;
transition: background-color 0.3s;
display: inline-block;
border: 1px solid $gray-40;
Expand All @@ -174,34 +178,35 @@
-ms-transition: background .55s ease;
-o-transition: background .55s ease;
transition: background .55s ease;
padding-left: 15px;
-webkit-font-smoothing: antialiased;

&:hover,
&:focus,
&:active {
outline: none;
background: $accent-lightest;
}
}

.tt-hint {
color: $gray-35;
background-color: transparent !important;
}

#search-box, .tt-hint {
outline: none;
font-size: 16px;
line-height: 30px;
font-weight: 400;
font-style: normal;
font-family: $font-sans;
border: none;
padding-left: 15px;
width: calc(100% - 65px);
height: 100%;
-webkit-appearance: none;
-webkit-font-smoothing: antialiased;
.tt-hint {
color: $gray-30;
background-color: transparent !important;
outline: none;
border: none;
-webkit-appearance: none;
-webkit-font-smoothing: antialiased;
}

// to account for case where typeahead fails to load
.twitter-typeahead.tt-input {
box-shadow: none;
border: none;
padding-left: 0;
}
}


.icon{
position: relative;
z-index: 10;
Expand Down