Update search input styles

This commit is contained in:
Ryan Watters 2017-02-10 21:10:31 -08:00
parent 7234c140c0
commit 03dc2766ac
11 changed files with 182 additions and 50 deletions

View File

@ -12,4 +12,6 @@ draft: false
slug:
aliases: []
notes:
---
---
The Hugo docs have been completely reformatted to include

Binary file not shown.

View File

@ -1,14 +1,15 @@
{{$version := .Hugo.Version}}
<header id="site-header" class="site-header">
<div class="hugo-meta" title="Hugo version {{$version}}">
<a href="/" id="home-link">
<img src="/images/hugo-logo-wide.png" alt=""><span class="hugo-v">v{{$version}}</span>
</a>
<a href="/" id="home-link">
<img src="/images/hugo-logo-wide.png" alt=""><span class="hugo-v">v{{$version}}</span>
</a>
</div>
<a href="#" id="toggle-search">
</header>
<a href="#" id="toggle-search">
<i class="icon-search"></i>
</a>
<form id="site-search-form" action="">
<input type="search" id="search-input" placeholder="Search {{.Site.Title}}...">
</form>
</header>

View File

@ -1,8 +1,8 @@
<script src="{{.Site.BaseURL}}js/vendor/jquery-2.2.4.min.js"></script>
<script src="/js/script.min.js" async></script>
{{$gaid := .Site.Params.googleanalyticstrackingcode }}
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
{{$gaid := .Site.Params.googleanalyticstrackingcode }}
<script>
(function() {
if (window.location.hostname === "localhost") {

View File

@ -1,5 +1,9 @@
$('#toggle-search').on('click',function(evt){
evt.preventDefault();
evt.stopPropagation();
$('#site-search-form').toggleClass('search-open');
});
$('#toggle-search').on('click', function(evt) {
evt.preventDefault();
evt.stopPropagation();
$('#site-search-form').toggleClass('search-open');
window.setTimeout(function() {
var sInput = document.getElementById('search-input');
sInput.focus();
},400);
});

View File

@ -47,7 +47,7 @@ $button-border-radius: .25em;
//Codeblocks
$code-font-family:'courierprime',courier,monospace;
$code-tooltip-bg-color: $hugo-blue;
$code-tooltip-bg-color: $hugo-pink;
$code-block-base-font-color: #ffffff;
$code-block-background-color: $hugo-black;
$code-editor-header-bg-color: $hugo-gray-dark;

View File

@ -1,5 +1,6 @@
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS and IE text size adjust after device orientation change,
@ -7,11 +8,15 @@
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
font-family: sans-serif;
/* 1 */
-ms-text-size-adjust: 100%;
/* 2 */
-webkit-text-size-adjust: 100%;
/* 2 */
}
/**
* Remove default margin.
*/
@ -20,9 +25,11 @@ body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
@ -46,6 +53,7 @@ summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
@ -55,10 +63,13 @@ audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
display: inline-block;
/* 1 */
vertical-align: baseline;
/* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
@ -69,6 +80,7 @@ audio:not([controls]) {
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
@ -79,9 +91,11 @@ template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
@ -90,6 +104,7 @@ a {
background-color: transparent;
}
/**
* Improve readability of focused elements when they are also in an
* active/hover state.
@ -100,9 +115,11 @@ a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
@ -111,6 +128,7 @@ abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
@ -120,6 +138,7 @@ strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
@ -128,6 +147,7 @@ dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
@ -138,6 +158,7 @@ h1 {
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
@ -147,6 +168,7 @@ mark {
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
@ -155,6 +177,7 @@ small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
@ -175,9 +198,11 @@ sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
@ -186,6 +211,7 @@ img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
@ -194,9 +220,11 @@ svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
@ -205,6 +233,7 @@ figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
@ -214,6 +243,7 @@ hr {
height: 0;
}
/**
* Contain overflow in all browsers.
*/
@ -222,6 +252,7 @@ pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
@ -234,14 +265,17 @@ samp {
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
@ -254,11 +288,15 @@ input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
color: inherit;
/* 1 */
font: inherit;
/* 2 */
margin: 0;
/* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
@ -267,6 +305,7 @@ button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
@ -279,6 +318,7 @@ select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
@ -288,13 +328,19 @@ select {
*/
button,
html input[type="button"], /* 1 */
html input[type="button"],
/* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
-webkit-appearance: button;
/* 2 */
cursor: pointer;
/* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
@ -304,6 +350,7 @@ html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
@ -314,6 +361,7 @@ input::-moz-focus-inner {
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
@ -323,6 +371,7 @@ input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
@ -333,10 +382,13 @@ input {
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
@ -348,16 +400,22 @@ input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
box-sizing: content-box; /* 2 */
-webkit-appearance: textfield;
/* 1 */
box-sizing: content-box;
/* 2 */
border-radius: 0px;
outline:none;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
@ -369,6 +427,7 @@ input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
@ -379,16 +438,20 @@ fieldset {
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
border: 0;
/* 1 */
padding: 0;
/* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
@ -397,6 +460,7 @@ textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
@ -406,9 +470,11 @@ optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/

View File

@ -1,26 +1,78 @@
#toggle-search {
display:block;
float:right;
margin-right:20px;
z-index:60;
display: block;
position: fixed;
top: .5em;
right: .5em;
float: right;
margin-right: 20px;
font-size: 1.2em;
z-index: 60;
}
form#site-search-form {
display: block;
position: fixed;
top: 10px;
right: 10px;
z-index: 50;
width: 300px;
transform: translateX(290px);
transition: transform .3s ease-in-out;
display: flex;
align-items: center;
width: 100%;
width: 100vw;
position: fixed;
top: $site-header-height;
height: $site-header-height * .9;
transform:translateY(-#{$site-header-height});
background-color: $body-bg-color;
z-index: 19;
box-shadow: 0 3px 6px rgba($hugo-pink, 0.15), 0 3px 6px rgba($hugo-pink, 0.3);
&.search-open {
transition: transform .3s ease-in-out;
border-bottom: 1px solid $base-font-color;
transform: translateX(0px);
transform: translateY(0);
border-bottom: 1px solid $hugo-pink;
}
#search-input {
max-height: $site-header-height * .9;
padding-left: 20px;
font-size: 24px;
}
}
@include MQ(L) {
form#site-search-form {
display: block;
position: fixed;
top: 8px;
right: 0px;
z-index: 50;
width: 300px;
transform: translateX(290px);
transition: transform .3s ease-in-out;
box-shadow: none;
max-height: $site-header-height * .8;
&.search-open {
transition: transform .3s ease-in-out;
border-bottom-width: 0px;
transform: translateX(0px);
#search-input {
transition: opacity .3 ease-in-out;
opacity: 1;
border-bottom:3px solid $hugo-pink;
&::after {
display:inline-block;
content:'';
width:1em;
border-bottom:3px solid $hugo-pink;
}
}
}
#search-input {
transition: opacity .3s ease-in-out;
max-height: $site-header-height * .8;
padding-left: 0px;
font-size: 20px;
opacity: 0;
}
}
}
//clear default search styles
#search-input {
@include on-event($self: true) {
outline: none;
@ -28,6 +80,7 @@ form#site-search-form {
width:260px;
outline:none;
border:0px;
border-radius:0px;
}
@ -98,8 +151,8 @@ form#site-search-form {
}
.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column-text .algolia-docsearch-suggestion--highlight {
color:$hugo-blue;
font-weight:bold;
color: $hugo-blue;
font-weight: bold;
background: desaturate(lighten($hugo-blue, 50%), 30%);
}

View File

@ -11,14 +11,22 @@
position: fixed;
top: 0px;
left: 0px;
z-index: 10;
z-index: 20;
@include card(1);
@include MQ(L) {
justify-content: space-between;
}
.hugo-meta {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
@include MQ(L) {
float: left;
width: auto;
justify-content: flex-start;
// max-width: 200px;
}
}
#home-link {
display: flex;
@ -49,5 +57,3 @@
margin-left: 1em;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long