From a1dfc548198a1326e71f1dd70303a5d3441f7a39 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Fri, 21 Jun 2024 13:02:08 +0200
Subject: refactor: switch to templ for HTML templates
---
internal/components/optionDetail.templ | 58 ++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 internal/components/optionDetail.templ
(limited to 'internal/components/optionDetail.templ')
diff --git a/internal/components/optionDetail.templ b/internal/components/optionDetail.templ
new file mode 100644
index 0000000..52ce859
--- /dev/null
+++ b/internal/components/optionDetail.templ
@@ -0,0 +1,58 @@
+package components
+
+import "searchix/internal/nix"
+
+templ OptionDetail(option nix.Option) {
+
{ option.Name }
+ @markdown(option.Description)
+
+ if option.Type != "" {
+ - Type
+ { option.Type }
+ }
+ if option.Default != nil {
+ if option.Default.Text != "" || option.Default.Markdown != "" {
+ - Default
+ -
+ if option.Default.Markdown != "" {
+ @markdown(option.Default.Markdown)
+ } else {
+
{ option.Default.Text }
+ }
+
+ }
+ }
+ if option.Example != nil {
+ if option.Example.Text != "" || option.Example.Markdown != "" {
+ - Example
+ -
+ if option.Example.Markdown != "" {
+ @markdown(option.Example.Markdown)
+ } else {
+
{ option.Example.Text }
+ }
+
+ }
+ }
+ if option.RelatedPackages != "" {
+ - Related Packages
+ -
+ @markdown(option.RelatedPackages)
+
+ }
+ if len(option.Declarations) > 0 {
+ - Declared
+ for _, d := range option.Declarations {
+ -
+ { d.Name }
+
+ }
+ }
+
+}
+
+templ OptionDetailPage(tdata TemplateData, option nix.Option) {
+ @Page(tdata) {
+ @OptionDetail(option)
+ }
+}
--
cgit 1.4.1