From 33b1bd1c85c26728583278ad445a5fff61bcea0a Mon Sep 17 00:00:00 2001 From: Dominic Monroe Date: Sat, 15 May 2021 01:29:51 +0100 Subject: [PATCH] WIP: Add really fast search This rewrite eschews jQuery, and instead relies on modern browser APIs. This makes search fast enough that it's able to run without the need of debounce. --- css/style.css | 24 ++++++++------ index.html.erb | 6 ++-- js/main.js | 87 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 90 insertions(+), 27 deletions(-) diff --git a/css/style.css b/css/style.css index 889d3e1..0e6bccd 100644 --- a/css/style.css +++ b/css/style.css @@ -155,11 +155,24 @@ header #j { box-shadow: 0 0 10px #7be; } -html.no-js #project-list, html.no-js footer { +html.no-js footer { visibility: visible; } -#project-list, footer { +#project-list { + display: grid; + grid-gap: 1em 30px; + grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) ); + grid-auto-rows: 0; + visibility: hidden; +} + +html.no-js #project-list { + grid-auto-rows: auto; + visibility: visible; +} + +footer { visibility: hidden; } @@ -169,13 +182,6 @@ html.no-js #project-list, html.no-js footer { font-size: 11pt; } -#main .category { - width: 230px; - padding-left: 30px; - float: left; - margin-bottom: 1em; -} - #main .category h2 { font-size: 14pt; font-weight: bold; diff --git a/index.html.erb b/index.html.erb index f2305a5..7fbd949 100644 --- a/index.html.erb +++ b/index.html.erb @@ -37,6 +37,7 @@
<% @categories.sort_by { |c, ps| c.downcase }.each do |category, projects| %>
+

<%= category %>

    <% projects.each do |project| %> @@ -50,6 +51,7 @@ <% end %>
+
<% end %>
@@ -72,10 +74,6 @@ - - - -