diff --git a/ejs-views/partials/search_bar.ejs b/ejs-views/partials/search_bar.ejs index 6e2f04c..57a3575 100644 --- a/ejs-views/partials/search_bar.ejs +++ b/ejs-views/partials/search_bar.ejs @@ -1,10 +1,68 @@

Packages make Pulsar do amazing things.

-
+ + +

Method to sort the search results.

+ + +

Direction to list search results.

+ +
-
\ No newline at end of file + diff --git a/src/handlers.js b/src/handlers.js index 8f9b2f5..823c8df 100644 --- a/src/handlers.js +++ b/src/handlers.js @@ -117,12 +117,20 @@ async function searchHandler(req, res, timecop) { timecop.start("transcribe-json"); let obj = await utils.prepareForListing(api.body); timecop.end("transcribe-json"); - res.render("search", { dev: DEV, packages: obj, search: req.query.q, pagination, timecop: timecop.timetable, page: { - name: `Search ${req.query.q}`, - og_url: "https://web.pulsar-edit.dev/packages/search", - og_description: "The Pulsar Package Repository", - og_image: "https://web.pulsar-edit.dev/public/pulsar_name.svg", - og_image_type: "image/svg+xml" + res.render("search", { + dev: DEV, + packages: obj, + sortQuery: req.query.sort ?? "", + directionQuery: req.query.direction ?? "", + search: req.query.q, + pagination, + timecop: timecop.timetable, + page: { + name: `Search ${req.query.q}`, + og_url: "https://web.pulsar-edit.dev/packages/search", + og_description: "The Pulsar Package Repository", + og_image: "https://web.pulsar-edit.dev/public/pulsar_name.svg", + og_image_type: "image/svg+xml" }}); } catch(err) { console.log(err); diff --git a/src/site.css b/src/site.css index 564592d..c64769d 100644 --- a/src/site.css +++ b/src/site.css @@ -174,3 +174,35 @@ nav.active { #pagination a.disabled { @apply pointer-events-none text-secondary; } + +/**************************/ +/******** SEARCH **********/ +/**************************/ + +.search { + @apply my-12; +} + +.search .option-title { + @apply mb-4 mt-4; +} + +.search .radio-option-container { + @apply items-center w-full text-sm font-medium text-gray-900 border border-secondary bg-transparent rounded-lg sm:flex; +} + +.search .radio-option-container .radio-option-listing { + @apply w-full border-b border-secondary sm:border-b-0 sm:border-r; +} + +.search .radio-option-container .radio-option-listing .radio-option-inner { + @apply flex items-center pl-3; +} + +.search .radio-option-container .radio-option-listing .radio-option-inner .radio-option-input { + @apply w-4 h-4 text-primary bg-gray-100 border-gray-300 focus:ring-primary focus:ring-2; +} + +.search .radio-option-container .radio-option-listing .radio-option-inner .radio-option-label { + @apply w-full py-3 ml-2 text-sm font-medium text-text opacity-70; +}