diff --git a/public/assets/css/search.css b/public/assets/css/search.css index 6a128fb..a56e400 100644 --- a/public/assets/css/search.css +++ b/public/assets/css/search.css @@ -103,6 +103,35 @@ header h1 { word-break: break-word; } +/* -- Results > Types -- */ + +.card.error { + gap: unset; +} + +.card.error p > a { + background-color: rgba(var(--palette-contrast),.1); +} + +.resultsFooter { + display: flex; + justify-content: space-between; + align-items: center; +} + +.resultsFooter svg { + width: 41px; + height: 40px; +} + +.resultsFooter svg polygon { + fill: none; + stroke: var(--swatch-contrast); + stroke-width: 1px; +} + +/* ---- */ + .button { padding: var(--padding); text-align: center; @@ -136,6 +165,13 @@ header h1 { color: var(--swatch-contrast); cursor: pointer; } + + /* ---- */ + + .resultsFooter svg:hover polygon { + fill: var(--swatch-contrast); + cursor: pointer; + } } @media (pointer: fine) { diff --git a/src/search/Search.php b/src/search/Search.php index dd614fd..d486f1f 100644 --- a/src/search/Search.php +++ b/src/search/Search.php @@ -7,22 +7,38 @@ public function __construct() { $this->query = $query; - switch($_SERVER["HTTP_CONTENT_TYPE"]) { + $mime_type = $_SERVER["HTTP_CONTENT_TYPE"] ? $_SERVER["HTTP_CONTENT_TYPE"] : $_GET["f"]; + switch($mime_type) { + case "html": case "text/html": $this->get_html(); break; default: + case "json": case "application/json": $this->get_json(); break; } } + private function get_html_template($name) { + $path = dirname(__FILE__,1)."/templates/${name}.html"; + if(!is_file($path)) { + return $this->get_html_template("card_error_display"); + } + $html = Import::file($path); + return $html; + } + private function get_html() { - header("Content-Type: text/html"); - $template = Import::file("templates/default.html"); - echo $template; + $results = [ + $this->get_html_template("card_default"), + $this->get_html_template("defaults"), + $this->get_html_template("card_default"), + $this->get_html_template("result_about") + ]; + echo implode("",$results); } private function get_json() { diff --git a/src/search/templates/card_default.html b/src/search/templates/card_default.html new file mode 100644 index 0000000..29b5117 --- /dev/null +++ b/src/search/templates/card_default.html @@ -0,0 +1,8 @@ +
%s
+%s
+ +There was a problem displaying this result
+This is a problem on my side, sorry about that
+%s
%s
- + \ No newline at end of file diff --git a/src/search/templates/result_about.html b/src/search/templates/result_about.html new file mode 100644 index 0000000..e9c39ae --- /dev/null +++ b/src/search/templates/result_about.html @@ -0,0 +1,5 @@ + \ No newline at end of file