summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/campaign.lisp8
-rw-r--r--src/views/components.lisp33
-rw-r--r--src/views/hazard.lisp4
-rw-r--r--src/views/hero.lisp11
-rw-r--r--src/views/player.lisp8
-rw-r--r--src/views/quest.lisp4
-rw-r--r--src/views/rumor.lisp4
7 files changed, 72 insertions, 0 deletions
diff --git a/src/views/campaign.lisp b/src/views/campaign.lisp
new file mode 100644
index 0000000..5e1498a
--- /dev/null
+++ b/src/views/campaign.lisp
@@ -0,0 +1,8 @@
+;;;; views/campaign.lisp -- views of for campaign instances
+
+(in-package :dnd)
+
+
+(defrender :inline ((campaign campaign))
+ (with-html
+ (:a :href (urlpath campaign) (title campaign))))
diff --git a/src/views/components.lisp b/src/views/components.lisp
new file mode 100644
index 0000000..95ed062
--- /dev/null
+++ b/src/views/components.lisp
@@ -0,0 +1,33 @@
+;;;; views/components.lisp -- reusable components
+
+(in-package :dnd)
+
+;;; LIST DATA
+
+(defrender :list ((data list) (class "listview") (item-class "listitem"))
+ "A catch all for rendering lists of renderable data items as unordered
+lists. CLASS is the lass string for the containing list. ITEM-CLASS is
+the class string for the contained list items."
+ (with-html
+ (:ol :class class
+ (dolist (item data)
+ (:li :class item-class (render :list-item item))))))
+
+(defrender :horiz-list ((data list) (class "hlistview") (item-class "listitem"))
+ (with-html
+ (:ol :class class
+ (dolist (item data)
+ (:li :calss item-class (render :list-item item))))))
+
+;;;; PAGE ELEMENTS
+
+(defun navbar ()
+ (with-html
+ (:nav :class "navbar" :aria-label "Navigation"
+ (:div :class "logo" :aria-label "DND logo" "DND")
+ (:ul :class "nav-links" :aria-label "Nav links"
+ (:li (:a :href "/hero" :aria-label "Hero profile" "🧝"))
+ (:li (:a :href "/inventory" :aria-label "Inventory" "🎒"))
+ (:li (:a :href "/quests" :aria-label "Quests" "📜"))
+ (:li (:a :href "/tavern" :aria-label "Tavern" "🍺"))))))
+
diff --git a/src/views/hazard.lisp b/src/views/hazard.lisp
new file mode 100644
index 0000000..a842c6f
--- /dev/null
+++ b/src/views/hazard.lisp
@@ -0,0 +1,4 @@
+;;;; hazard.lisp -- views of hazard insances
+
+(in-package :dnd)
+
diff --git a/src/views/hero.lisp b/src/views/hero.lisp
new file mode 100644
index 0000000..7387901
--- /dev/null
+++ b/src/views/hero.lisp
@@ -0,0 +1,11 @@
+;;;; views/hero.lisp
+
+(in-package :dnd)
+
+(defrender :list-item ((hero hero))
+ (with-html
+ (with-slots ((name campaign) hero)
+ (:p name "the" (hero-class hero) (hero-title hero)
+ (when campaign
+ (:span "who is off in the campaign")
+ (:span (render :inline campaign)))))))
diff --git a/src/views/player.lisp b/src/views/player.lisp
new file mode 100644
index 0000000..087848e
--- /dev/null
+++ b/src/views/player.lisp
@@ -0,0 +1,8 @@
+;;;; views/player.lisp
+
+(in-package :dnd)
+
+(defrender :details ((player player))
+ (with-html
+ (:div :class "player details"
+ (:h3 "Welcome " (nickname player)))))
diff --git a/src/views/quest.lisp b/src/views/quest.lisp
new file mode 100644
index 0000000..0312dba
--- /dev/null
+++ b/src/views/quest.lisp
@@ -0,0 +1,4 @@
+;;;; views/quest.lisp
+
+(in-package :dnd)
+
diff --git a/src/views/rumor.lisp b/src/views/rumor.lisp
new file mode 100644
index 0000000..90f56ae
--- /dev/null
+++ b/src/views/rumor.lisp
@@ -0,0 +1,4 @@
+;;;; views/rumor.lisp
+
+(in-package :dnd)
+