diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index ebdd80c5..4b83ba75 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,44 +1,33 @@ @import "bootstrap"; -$site-header: 65px; +$site-header: 56px; $site-footer: 65px; +$zindex-header: 1080; // This ensures the header will be above popovers/tooltips. .container { min-height: calc(100vh - #{$site-footer} - #{$site-header}); -} - -.site-header { - height: $site-header; - padding: 20px 25px; - background-color: #f2f2f2; - border-bottom: 1px solid #ddd; - ul { - display: flex; - justify-content: space-between; - text-align: center; - margin: auto; - } + &.search-page { + max-width: 100vw; - li { - display: inline-block; - text-align: center; - margin: 0 20px; - - &.active { - font-weight: 600; - } - - a { - text-decoration: none; - - &:hover { - text-decoration: underline; + @include media-breakpoint-up(lg) { + .no-wrap-row { + display: flex; + flex-flow: row; + flex-wrap: nowrap; } } } } +@include media-breakpoint-up(lg) { + .navbar.sticky-header { + position: sticky; + top: 0; + z-index: $zindex-header; + } +} + .site-footer { min-height: $site-footer; height: auto; @@ -100,6 +89,10 @@ $site-footer: 65px; overflow: hidden; } +.card-body-scroll { + overflow: scroll; +} + @include media-breakpoint-up(lg) { .sticky-column { position: sticky; @@ -180,3 +173,24 @@ td.browser-support-info { margin-top: 8px; } } + +@include media-breakpoint-up(lg) { + .search-sidebar { + height: calc(100vh - #{$site-header}); + position: sticky; + top: $site-header; + border-right: 1px solid #ddd; + overflow: scroll; + + .form-group-title { + text-transform: uppercase; + font-size: 0.8rem; + font-weight: 600; + } + + .search-button-container { + position: sticky; + bottom: 10px; + } + } +} diff --git a/app/controllers/features_controller.rb b/app/controllers/features_controller.rb index eeb0e661..f91331f5 100644 --- a/app/controllers/features_controller.rb +++ b/app/controllers/features_controller.rb @@ -1,5 +1,7 @@ class FeaturesController < ApplicationController def index + @sticky_header = true + if params[:query].present? features = Feature.search(params[:query]) else diff --git a/app/views/features/_features_list.html.erb b/app/views/features/_features_list.html.erb index 2bbb2461..fadcc620 100644 --- a/app/views/features/_features_list.html.erb +++ b/app/views/features/_features_list.html.erb @@ -31,7 +31,7 @@ <%= link_to "MDN", feature.mdn_url, class: "card-link mdn-link" %> <% end %> -
+
diff --git a/app/views/features/index.html.erb b/app/views/features/index.html.erb index c46c3a2d..a391dead 100644 --- a/app/views/features/index.html.erb +++ b/app/views/features/index.html.erb @@ -1,124 +1,132 @@ -
-
-
- <%= form_tag("/features", method: "get", class: "w-100") do %> - <%= text_field_tag(:query, - params['query'], - placeholder: "Search", - class: "form-control") %> +
+
+
+
+ <%= form_tag("/features", method: "get", class: "w-100") do %> +
+
+ <%= text_field_tag(:query, + params['query'], + placeholder: "Search", + class: "form-control") %> +
-
-
- Categories: -
- <% @categories.each do |key, value| %> -
- <%= check_box_tag( - "categories[]", - key, - (true if params["categories"].present? && params["categories"].include?(key.to_s)), - {id: key} - ) %> - <%= label_tag(key, value) %> -
- <% end %> -
-
-
- Filters: -
-
- <%= label_tag("mdn_url", "Includes an MDN URL?") %> - <%= select_tag( - "mdn_url", - options_for_select( - [ - ['Has an MDN URL', true], - ['Has no MDN URL', false] - ], - params["mdn_url"] - ), - { include_blank: true } - ) %> -
+
+ Categories +
+
+ <% @categories.each do |key, value| %> +
+ <%= check_box_tag( + "categories[]", + key, + (true if params["categories"].present? && params["categories"].include?(key.to_s)), + {id: key, class: "form-check-input"} + ) %> + <%= label_tag(key, value, class: "form-check-label") %> +
+ <% end %> +
-
- <%= label_tag("description", "Includes a description?") %> - <%= select_tag( - "description", - options_for_select( - [ - ['Has a description', true], - ['Has no description', false] - ], - params["description"] - ), - { include_blank: true } - ) %> -
+
+ Filters +
+
+ <%= label_tag("mdn_url", "Includes an MDN URL?") %> + <%= select_tag( + "mdn_url", + options_for_select( + [ + ['Has an MDN URL', true], + ['Has no MDN URL', false] + ], + params["mdn_url"] + ), + { include_blank: true, class: "form-control form-control-sm" } + ) %> +
-
- <%= label_tag("deprecated", "Deprecated?") %> - <%= select_tag( - "deprecated", - options_for_select( - [ - ['Deprecated', true], - ['Not deprecated', false], - ['No deprecation info', "no_info"] - ], - params["deprecated"] - ), - { include_blank: true } - ) %> -
+
+ <%= label_tag("description", "Includes a description?") %> + <%= select_tag( + "description", + options_for_select( + [ + ['Has a description', true], + ['Has no description', false] + ], + params["description"] + ), + { include_blank: true, class: "form-control form-control-sm" } + ) %> +
-
- <%= label_tag("experimental", "Experimental?") %> - <%= select_tag( - "experimental", - options_for_select( - [ - ['Experimental', true], - ['Not experimental', false], - ['No experimental info', "no_info"] - ], - params["experimental"] - ), - { include_blank: true } - ) %> -
+
+ <%= label_tag("deprecated", "Deprecated?") %> + <%= select_tag( + "deprecated", + options_for_select( + [ + ['Deprecated', true], + ['Not deprecated', false], + ['No deprecation info', "no_info"] + ], + params["deprecated"] + ), + { include_blank: true, class: "form-control form-control-sm" } + ) %> +
+ +
+ <%= label_tag("experimental", "Experimental?") %> + <%= select_tag( + "experimental", + options_for_select( + [ + ['Experimental', true], + ['Not experimental', false], + ['No experimental info', "no_info"] + ], + params["experimental"] + ), + { include_blank: true, class: "form-control form-control-sm" } + ) %> +
+ +
+ <%= label_tag("standard_track", "Standard track?") %> + <%= select_tag( + "standard_track", + options_for_select( + [ + ['On standard track', true], + ['Not on standard track', false], + ['No standard track info', "no_info"] + ], + params["standard_track"] + ), + { include_blank: true, class: "form-control form-control-sm" } + ) %> +
+
-
- <%= label_tag("standard_track", "Standard track?") %> - <%= select_tag( - "standard_track", - options_for_select( - [ - ['On standard track', true], - ['Not on standard track', false], - ['No standard track info', "no_info"] - ], - params["standard_track"] - ), - { include_blank: true } - ) %> -
+
+ <%= submit_tag("Search", class: "btn btn-primary btn-lg btn-block search-button") %> +
+ <% end %>
+
- <%= submit_tag("Search", class: "btn btn-primary btn-lg btn-block") %> - <% end %> -
+
+

Features

-
- <% unless @feature_count.zero? %> -

Features: <%= @feature_count %>

- <% end %> - - <%= render 'features_list', - features: @features, - browsers: @browsers %> + <% unless @feature_count.zero? %> +

Features: <%= @feature_count %>

+ <% end %> + + <%= render 'features_list', + features: @features, + browsers: @browsers %> +
- -
diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index 87fe8eb1..cf9275fd 100644 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -1,4 +1,4 @@ -