From b336f583cb8e86c53d3d89111778c64d8e732faa Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Mon, 17 Dec 2018 15:06:08 -0800 Subject: [PATCH 1/4] Basic work for getting mobile search/navigation up to par --- lib/resources/script.js | 1 + lib/resources/styles.css | 25 +++++++++++++++++++++++-- lib/src/html/templates.dart | 1 + lib/src/model_utils.dart | 3 --- lib/templates/404error.html | 1 + lib/templates/_head.html | 2 -- lib/templates/_search_sidebar.html | 22 ++++++++++++++++++++++ lib/templates/category.html | 1 + lib/templates/class.html | 1 + lib/templates/constant.html | 1 + lib/templates/constructor.html | 1 + lib/templates/enum.html | 1 + lib/templates/function.html | 1 + lib/templates/index.html | 1 + lib/templates/library.html | 1 + lib/templates/method.html | 1 + lib/templates/mixin.html | 1 + lib/templates/property.html | 1 + lib/templates/top_level_constant.html | 1 + lib/templates/top_level_property.html | 1 + lib/templates/typedef.html | 1 + tool/grind.dart | 6 ++++-- 22 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 lib/templates/_search_sidebar.html diff --git a/lib/resources/script.js b/lib/resources/script.js index 3910d1257d..64cde92c86 100644 --- a/lib/resources/script.js +++ b/lib/resources/script.js @@ -197,4 +197,5 @@ document.addEventListener("DOMContentLoaded", function() { initSideNav(); initSearch("search-box"); initSearch("search-body"); + initSearch("search-sidebar"); }); diff --git a/lib/resources/styles.css b/lib/resources/styles.css index 94fbb83639..65498d107f 100644 --- a/lib/resources/styles.css +++ b/lib/resources/styles.css @@ -49,6 +49,10 @@ header form { padding-right: 30px; } +header#header-search-sidebar { + height: 50px; +} + footer { flex: 0 0 16px; text-align: center; @@ -110,12 +114,18 @@ nav.navbar { border: 0; } -@media (max-width: 767px) { +@media (max-width: 768px) { .hidden-xs { display: none!important; } } +@media (min-width: 769px) { + .hidden-l { + display: none!important; + } +} + nav.navbar .row { padding-top: 8px; } @@ -740,6 +750,14 @@ button { padding: 10px; } + ol#sidebar-nav { + display: contents; + } + + .sidebar h5 { + margin-top: 25px; + } + .sidebar-offcanvas-left.active { left: 0; /* this animates our drawer into the page */ } @@ -777,10 +795,13 @@ button { border: 0; } -@media screen and (max-width: 500px) { +@media screen and (max-width: 768px) { form.search { display: none; } + form.search.sidebar-offcanvas-left { + display: contents; + } } .typeahead, diff --git a/lib/src/html/templates.dart b/lib/src/html/templates.dart index 138494b2a3..55f1a2f3eb 100644 --- a/lib/src/html/templates.dart +++ b/lib/src/html/templates.dart @@ -25,6 +25,7 @@ const _partials = const [ 'features', 'documentation', 'name_summary', + 'search_sidebar', 'sidebar_for_class', 'sidebar_for_category', 'sidebar_for_enum', diff --git a/lib/src/model_utils.dart b/lib/src/model_utils.dart index 28ccce0347..ca9fc982ab 100644 --- a/lib/src/model_utils.dart +++ b/lib/src/model_utils.dart @@ -10,9 +10,6 @@ import 'dart:io'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/src/dart/ast/utilities.dart'; -import 'package:analyzer/src/generated/engine.dart'; -import 'package:analyzer/src/generated/sdk.dart'; -import 'package:analyzer/src/generated/source_io.dart'; import 'package:dartdoc/src/model.dart'; final Map _fileContents = {}; diff --git a/lib/templates/404error.html b/lib/templates/404error.html index 305b2a6148..e3f6591baa 100644 --- a/lib/templates/404error.html +++ b/lib/templates/404error.html @@ -1,6 +1,7 @@ {{>head}} diff --git a/lib/templates/_head.html b/lib/templates/_head.html index 7c4882eb96..7e299a6ab1 100644 --- a/lib/templates/_head.html +++ b/lib/templates/_head.html @@ -30,9 +30,7 @@
- {{^navLinks.isEmpty}} - {{/navLinks.isEmpty}}