From e505bb428958f18608a50542c94d92cad26b29d2 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Thu, 12 Sep 2024 14:57:54 +0200 Subject: [PATCH] add search page --- assets/css/src/search.css | 24 ++++++++++++++++++++++++ assets/css/style.css | 1 + site/config/config.php | 1 + site/config/routes/virtual-search.php | 16 ++++++++++++++++ site/controllers/search.php | 14 ++++++++++++++ site/snippets/nav.php | 4 ++-- site/templates/search.php | 27 +++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 assets/css/src/search.css create mode 100644 site/config/routes/virtual-search.php create mode 100644 site/controllers/search.php create mode 100644 site/templates/search.php diff --git a/assets/css/src/search.css b/assets/css/src/search.css new file mode 100644 index 0000000..7ee6d7f --- /dev/null +++ b/assets/css/src/search.css @@ -0,0 +1,24 @@ +.search { + background-color: var(--color-pink-light); + width: 100vw; + height: 70vh; + padding-top: 20vh !important; +} + +.search-form { + width: fit-content; + margin: auto; +} + +.search-input { + border-bottom: var(--border); + width: 40vw; + margin-right: 2rem; + padding: 0.3rem 0.5rem; + font-size: var(--font-size-h2); +} + +.search-submit { + width: 2rem; + height: 2rem; +} diff --git a/assets/css/style.css b/assets/css/style.css index 228fac9..6da5870 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -16,5 +16,6 @@ @import url("src/collapsable-section.css"); @import url("src/program-filters.css"); @import url("src/page-sectioned.css"); +@import url("src/search.css"); @import url("src/footer.css"); @import url("src/responsive.css"); diff --git a/site/config/config.php b/site/config/config.php index cc5b688..e46dc9d 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -38,6 +38,7 @@ return [ require_once(__DIR__ . '/routes/update-mapado-event.php'), require_once(__DIR__ . '/routes/mapado-fetch.php'), require_once(__DIR__ . '/routes/brevo-create-contact.php'), + require_once(__DIR__ . '/routes/virtual-search.php') ], 'hooks' => [ 'page.update:after' => require_once(__DIR__ . '/hooks/update-mapado-event.php') diff --git a/site/config/routes/virtual-search.php b/site/config/routes/virtual-search.php new file mode 100644 index 0000000..f785f5c --- /dev/null +++ b/site/config/routes/virtual-search.php @@ -0,0 +1,16 @@ + '/recherche', + 'action' => function () { + return Page::factory([ + 'slug' => 'search', + 'template' => 'search', + 'model' => 'search', + 'content' => [ + 'title' => 'Recherche', + 'uuid' => Kirby\Uuid\Uuid::generate(), + ] + ]); + } +]; \ No newline at end of file diff --git a/site/controllers/search.php b/site/controllers/search.php new file mode 100644 index 0000000..0c9a06b --- /dev/null +++ b/site/controllers/search.php @@ -0,0 +1,14 @@ +children()->children(); + $results = $allEvents->search($query, 'title|text'); + + return [ + 'query' => $query, + 'results' => $results, + ]; + +}; \ No newline at end of file diff --git a/site/snippets/nav.php b/site/snippets/nav.php index 2bec799..d0cc2a0 100644 --- a/site/snippets/nav.php +++ b/site/snippets/nav.php @@ -23,9 +23,9 @@ option('ticketingUrl')]) ?> - + + + + + + \ No newline at end of file