about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--frontend/static/style.css14
-rw-r--r--frontend/templates/blocks/options.gotmpl45
-rw-r--r--internal/server/option.go6
3 files changed, 51 insertions, 14 deletions
diff --git a/frontend/static/style.css b/frontend/static/style.css
index 96b7c9b..e72df60 100644
--- a/frontend/static/style.css
+++ b/frontend/static/style.css
@@ -5,3 +5,17 @@ form {
 input[type="search"] {
   width: 100%;
 }
+
+dt::after {
+  content: ": ";
+}
+
+dd {
+  margin-inline-start: 1rem;
+}
+
+dl {
+  display: grid;
+  grid-template-rows: 100%;
+  grid-template-columns: max-content 1fr;
+}
diff --git a/frontend/templates/blocks/options.gotmpl b/frontend/templates/blocks/options.gotmpl
index 3451eb3..e67a5c1 100644
--- a/frontend/templates/blocks/options.gotmpl
+++ b/frontend/templates/blocks/options.gotmpl
@@ -1,13 +1,36 @@
 {{ define "results" }}
-  {{ range $opt, $data := .Results }}
-  <details>
-    <summary>
-      {{ $opt }}
-    </summary>
-    <p>
-      {{ $data.Description }}
-    </p>
-  </details>
-  {{ end }}
-</div>
+  {{- range $opt, $data := .Results }}
+    <details>
+      <summary>
+        {{ $opt }}
+      </summary>
+      <p>
+        {{ $data.Description }}
+      </p>
+      <dl>
+        {{- with $data.Type }}
+          <dt>Type</dt>
+          <dd>{{ . }}</dd>
+        {{- end }}
+        {{- with $data.Default }}
+          <dt>Default</dt>
+          <dd><code>{{ .Text }}</code></dd>
+        {{- end }}
+        {{- with $data.Example }}
+          {{- if .Text }}
+            <dt>Example</dt>
+            <dd><code>{{ .Text }}</code></dd>
+          {{- end }}
+        {{- end }}
+        {{- with $data.Declarations }}
+          <dt>Declared</dt>
+          {{- range . }}
+            <dd>
+              <a href="file://{{ . }}">{{ . }}</a>
+            </dd>
+          {{- end }}
+        {{- end }}
+      </dl>
+    </details>
+  {{- end }}
 {{ end }}
diff --git a/internal/server/option.go b/internal/server/option.go
index be42689..2712d8a 100644
--- a/internal/server/option.go
+++ b/internal/server/option.go
@@ -1,8 +1,8 @@
 package server
 
 type NixValue struct {
-	Kind  string `json:"_type"`
-	Value string `json:"text"`
+	Type string `json:"_type"`
+	Text string `json:"text"`
 }
 
 type Option struct {
@@ -11,5 +11,5 @@ type Option struct {
 	Description  string
 	Example      NixValue
 	ReadOnly     bool
-	Kind         string `json:"type"`
+	Type         string `json:"type"`
 }