diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-01-26 15:42:52 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-26 15:42:52 -0600 |
commit | 382e20f573d55a4e14de935c3573899816b03761 (patch) | |
tree | 4b80746717a077bd7d25c9c8837c18bc45152ac4 /core | |
parent | e21170bd1a751454bc8f6c541d5733ca88d25961 (diff) | |
parent | 7b4b45306b2b83b5b5542eea33cca00c1746d162 (diff) | |
download | nextcloud-server-382e20f573d55a4e14de935c3573899816b03761.tar.gz nextcloud-server-382e20f573d55a4e14de935c3573899816b03761.zip |
Merge pull request #3249 from nextcloud/add-clear-search-button
Add clear search button
Diffstat (limited to 'core')
-rw-r--r-- | core/css/icons.scss | 4 | ||||
-rw-r--r-- | core/css/styles.scss | 61 | ||||
-rw-r--r-- | core/img/actions/close-white.svg | 4 | ||||
-rw-r--r-- | core/search/js/search.js | 4 | ||||
-rw-r--r-- | core/templates/layout.user.php | 1 |
5 files changed, 54 insertions, 20 deletions
diff --git a/core/css/icons.scss b/core/css/icons.scss index 1e72b71ad3d..28f6bd9bbb8 100644 --- a/core/css/icons.scss +++ b/core/css/icons.scss @@ -138,6 +138,10 @@ img, object, video, button, textarea, input, select { background-image: url('../img/actions/close.svg?v=1'); } +.icon-close-white { + background-image: url('../img/actions/close-white.svg?v=1'); +} + .icon-comment { background-image: url('../img/actions/comment.svg?v=1'); } diff --git a/core/css/styles.scss b/core/css/styles.scss index a709ef56152..d958a01655b 100644 --- a/core/css/styles.scss +++ b/core/css/styles.scss @@ -170,28 +170,49 @@ body { /* Searchbox */ -.searchbox input[type='search'] { +.searchbox { position: relative; - font-size: 1.2em; - padding: 3px; - padding-left: 25px; - background: transparent url('../img/actions/search-white.svg?v=1') no-repeat 6px center; - color: #fff; - border: 0; - border-radius: 3px; - margin-top: 3px; - width: 0; - cursor: pointer; - -webkit-transition: all 100ms; - transition: all 100ms; - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)'; - opacity: .7; - &:focus, &:active, &:valid { + input[type='search'] { + position: relative; + font-size: 1.2em; + padding: 3px; + padding-left: 25px; + background: transparent url('../img/actions/search-white.svg?v=1') no-repeat 6px center; color: #fff; - width: 155px; - cursor: text; - background-color: #0082c9 !important; - border: 1px solid rgba(255, 255, 255, 0.5) !important; + border: 0; + border-radius: 3px; + margin-top: 3px; + width: 0; + cursor: pointer; + -webkit-transition: all 100ms; + transition: all 100ms; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)'; + opacity: .7; + &:focus, &:active, &:valid { + color: #fff; + width: 155px; + cursor: text; + background-color: #0082c9 !important; + border: 1px solid rgba(255, 255, 255, 0.5) !important; + } + & ~ .icon-close-white { + display: inline; + position: absolute; + width: 15px; + height: 32px; + right: 3px; + top: 0; + &, &:focus, &:active, &:hover { + border: none; + background-color: transparent; + } + } + &:not(:valid) ~ .icon-close-white { + display: none; + } + &::-webkit-search-cancel-button { + -webkit-appearance: none; + } } } diff --git a/core/img/actions/close-white.svg b/core/img/actions/close-white.svg new file mode 100644 index 00000000000..cd2a8c62468 --- /dev/null +++ b/core/img/actions/close-white.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1"> + <path fill="#fff" d="m12.95 11.536l-1.414 1.414-3.536-3.536-3.535 3.536-1.415-1.414 3.536-3.536-3.536-3.536 1.415-1.414 3.535 3.536 3.516-3.555 1.434 1.434-3.536 3.535z"/> +</svg> diff --git a/core/search/js/search.js b/core/search/js/search.js index 4dd29ef917f..44a69842374 100644 --- a/core/search/js/search.js +++ b/core/search/js/search.js @@ -405,6 +405,10 @@ $(document).ready(function() { OC.Search = new OCA.Search($('#searchbox'), $('#searchresults')); }); } + $('#searchbox + .icon-close-white').click(function() { + OC.Search.clear(); + $('#searchbox').focus(); + }); }); /** diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 6cf4a0b8f2d..4842a94897d 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -69,6 +69,7 @@ <input id="searchbox" type="search" name="query" value="" required autocomplete="off" tabindex="5"> + <button class="icon-close-white" type="reset"></button> </form> <div id="settings"> <div id="expand" tabindex="6" role="link" class="menutoggle"> |