[Search] Hover and loading

Added styling to result items when they are
hovered over.
Also added a loading icon.
This commit is contained in:
shale
2015-07-23 11:41:17 -07:00
parent 4759162bb7
commit ebb5474b34
4 changed files with 94 additions and 9 deletions

View File

@@ -280,18 +280,38 @@ ul.tree {
margin-top: 10px; margin-top: 10px;
width: 100%; } width: 100%; }
/* line 39, ../sass/search/_search.scss */ /* line 39, ../sass/search/_search.scss */
.search-holder .search .load-icon {
position: relative; }
/* line 41, ../sass/search/_search.scss */
.search-holder .search .load-icon.loading {
pointer-events: none;
margin-left: 6px; }
/* line 45, ../sass/search/_search.scss */
.search-holder .search .load-icon.loading .title-label {
font-style: italic;
font-size: .9em;
opacity: 0.5;
margin-left: 26px;
line-height: 24px; }
/* line 55, ../sass/search/_search.scss */
.search-holder .search .load-icon.loading .wait-spinner {
margin-left: 6px; }
/* line 60, ../sass/search/_search.scss */
.search-holder .search .load-icon:not(.loading) {
cursor: pointer; }
/* line 65, ../sass/search/_search.scss */
.search-holder .search .results { .search-holder .search .results {
margin-top: 10px; } margin-top: 10px; }
/* line 43, ../sass/search/_search.scss */ /* line 69, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item { .search-holder .search .results .search-result-item {
margin-bottom: 5px; margin-bottom: 5px;
border-radius: 2px; border-radius: 2px;
padding-top: 2px; padding-top: 2px;
padding-bottom: 1px; } padding-bottom: 1px; }
/* line 52, ../sass/search/_search.scss */ /* line 78, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item .label { .search-holder .search .results .search-result-item .label {
margin-left: 6px; } margin-left: 6px; }
/* line 56, ../sass/search/_search.scss */ /* line 82, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item .label .title-label { .search-holder .search .results .search-result-item .label .title-label {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
@@ -303,17 +323,27 @@ ul.tree {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; } white-space: nowrap; }
/* line 78, ../sass/search/_search.scss */ /* line 104, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item.selected { .search-holder .search .results .search-result-item.selected {
background: #005177; background: #005177;
color: #fff; } color: #fff; }
/* line 82, ../sass/search/_search.scss */ /* line 108, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item.selected .view-control { .search-holder .search .results .search-result-item.selected .view-control {
color: #0099cc; } color: #0099cc; }
/* line 85, ../sass/search/_search.scss */ /* line 111, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item.selected .label .type-icon { .search-holder .search .results .search-result-item.selected .label .type-icon {
color: #fff; } color: #fff; }
/* line 92, ../sass/search/_search.scss */ /* line 118, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item:not(.selected):hover {
background: #404040;
color: #cccccc; }
/* line 121, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item:not(.selected):hover .context-trigger {
display: block; }
/* line 124, ../sass/search/_search.scss */
.search-holder .search .results .search-result-item:not(.selected):hover .icon {
color: #33ccff; }
/* line 132, ../sass/search/_search.scss */
.search-holder .search .load-more-button { .search-holder .search .load-more-button {
margin-top: 5px; margin-top: 5px;
position: relative; position: relative;

View File

@@ -36,6 +36,32 @@
width: 100%; width: 100%;
} }
.load-icon {
position: relative;
&.loading {
pointer-events: none;
margin-left: $leftMargin;
.title-label {
// Text styling
font-style: italic;
font-size: .9em;
opacity: 0.5;
// Text positioning
margin-left: $iconWidth + $leftMargin;
line-height: 24px;
}
.wait-spinner {
margin-left: $leftMargin;
}
}
&:not(.loading) {
cursor: pointer;
}
}
.results { .results {
// Spacing away from the search input // Spacing away from the search input
margin-top: 10px; margin-top: 10px;
@@ -83,7 +109,21 @@
color: $colorItemTreeIcon; color: $colorItemTreeIcon;
} }
.label .type-icon { .label .type-icon {
color: #fff; //$colorItemTreeIconHover; color: #fff;
}
}
// Change styling when it's being hovered over
&:not(.selected) {
&:hover {
background: lighten($colorBodyBg, 5%);
color: lighten($colorBodyFg, 20%);
.context-trigger {
display: block;
}
.icon {
color: $colorItemTreeIconHover;
}
} }
} }
} }

View File

@@ -39,6 +39,14 @@
</mct-representation> </mct-representation>
</div> </div>
<!-- Loading icon -->
<div class="load-icon"
ng-class="{loading: controller.isLoading()}"
ng-if="controller.isLoading()">
<span class="icon wait-spinner"></span>
<span class="title-label">Loading...</span>
</div>
<!-- Load more --> <!-- Load more -->
<div ng-if="controller.areMore()"> <div ng-if="controller.areMore()">
<button class="load-more-button btn very-subtle" <button class="load-more-button btn very-subtle"

View File

@@ -32,7 +32,8 @@ define(function () {
function SearchController($scope, $timeout, searchService) { function SearchController($scope, $timeout, searchService) {
// Starting amount of results to load. Will get increased. // Starting amount of results to load. Will get increased.
var numResults = INITIAL_LOAD_NUMBER; var numResults = INITIAL_LOAD_NUMBER,
loading = false;
function update(timestamp) { function update(timestamp) {
// Get the results // Get the results
@@ -45,10 +46,12 @@ define(function () {
// If any of the timestamps are older than the one we made the query with // If any of the timestamps are older than the one we made the query with
if (areOld) { if (areOld) {
// Then wait and try to update again // Then wait and try to update again
loading = true;
searchService.updateResults(); searchService.updateResults();
$timeout(waitForLatest, 100); $timeout(waitForLatest, 100);
} else { } else {
// We got the latest results now // We got the latest results now
loading = false;
$scope.results = searchService.getLatestResults(0, numResults); $scope.results = searchService.getLatestResults(0, numResults);
} }
} }
@@ -88,6 +91,10 @@ define(function () {
} }
}, },
isLoading: function () {
return loading;
},
/** /**
* Checks to see if there are more search results to display. * Checks to see if there are more search results to display.
*/ */