summary refs log tree commit diff homepage
path: root/src/xhtml.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/xhtml.cr')
-rw-r--r--src/xhtml.cr32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/xhtml.cr b/src/xhtml.cr
index 52d089a..b9d6d4c 100644
--- a/src/xhtml.cr
+++ b/src/xhtml.cr
@@ -22,32 +22,11 @@ require "xml"
 require "./http"
 require "./sqlite"
 
-CSS = "
-      html {
-          margin: auto;
-          max-width: 72ch;
-      }
-      body { margin-bottom: 2rem }
-      h1, h2, h3, h4, h5, h6 { margin: 1ex 0 }
-      a { text-decoration: none }
-      a:hover { text-decoration: underline }
-      form {
-          display: grid;
-          grid-template-columns: max-content 1fr 0;
-      }
-      form input { margin-bottom: 1ex }
-      form label { margin-right: 1ch }
-      form label.error {
-        color: ActiveText;
-        margin-top: -1ex;
-        margin-bottom: 1ex;
-      }
-    "
-
 class Page
   def initialize(static_dir : Path, static_url : String, api_url : String,
-                 db : Database)
+                 css : Path, db : Database)
     Dir.mkdir_p static_dir
+    File.copy css, static_dir / "style.css"
     @static_file = static_dir / "index.xhtml"
     @static_url = static_url
     @static_host = URI.parse(static_url).host
@@ -110,10 +89,10 @@ class Page
             errors.fetch("opennic", nil), params.fetch("opennic", "")
       input xml, "url", "icann", "https://.*", "ICANN URL:",
             errors.fetch("icann", nil), params.fetch("icann", "")
-      xml.element "input", type: "hidden", name: "host", value: @static_host
       xml.element "span" do
-        xml.element "input", type: "submit", value: "Let me in!"
+        xml.element "input", type: "hidden", name: "host", value: @static_host
       end
+      xml.element "input", type: "submit", value: "Let me in!"
       xml.element "br"
     end
 
@@ -145,8 +124,9 @@ class Page
           xml.element "meta", name: "viewport",
                       content: "width=device-width,initial-scale=1.0"
           xml.element "meta", name: "color-scheme", content: "light dark"
+          xml.element "base", href: @static_url
           xml.element "link", rel: "icon", href: "data:,"
-          xml.element "style" do xml.text CSS end
+          xml.element "link", rel: "stylesheet", href: "style.css"
           xml.element "title" do xml.text "le cercle libre" end
         end
         xml.element "body" do