aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--site/css.lisp29
-rw-r--r--site/home.lisp8
-rw-r--r--site/html.lisp14
-rw-r--r--site/login.lisp35
-rw-r--r--vampire.asd8
5 files changed, 68 insertions, 26 deletions
diff --git a/site/css.lisp b/site/css.lisp
new file mode 100644
index 0000000..ab01990
--- /dev/null
+++ b/site/css.lisp
@@ -0,0 +1,29 @@
+(in-package #:vampire)
+
+(defparameter +main-style+
+ (lass:compile-and-write
+ ;; Add variables here, not just for reuse, but also for at-a-glance
+ ;; documentation and easy-of-fiddling
+ '(:let ((main-bg "#1c1c1c")
+ (secondary-bg "#2e2e2e")
+ (tertiary-bg "#cccccc")
+ (main-color "#e8e7d5")
+ (secondary-color "#ffffff")
+ (tertiary-color "#000000"))
+ (body
+ :background #(main-bg)
+ :color #(main-color)
+ :justify-content center
+ :display flex
+ :width 90vw
+ :margin auto)
+
+ ;;(button)
+
+ ;;((and button :hover))
+ )))
+
+(wknd:defendpoint style.css
+ :get :route "css" "style.css"
+ :returns "text/css"
+ :handle +main-style+)
diff --git a/site/home.lisp b/site/home.lisp
index b96b52e..dcf929a 100644
--- a/site/home.lisp
+++ b/site/home.lisp
@@ -1,10 +1,8 @@
(in-package #:vampire)
-(defun home-page (user)
- (format nil "hey ~a" (user-name user)))
-
-(wknd:defendpoint home
+(wknd:defendpoint home.html
:using user-known
:get :route ""
:returns "text/html"
- :handle (home-page user))
+ :handle (page (:title "V A M P I R E")
+ (:p "hey " (user-name user))))
diff --git a/site/html.lisp b/site/html.lisp
new file mode 100644
index 0000000..d1d0f1a
--- /dev/null
+++ b/site/html.lisp
@@ -0,0 +1,14 @@
+(in-package #:vampire)
+
+
+(defmacro page ((&key (title "") (csspath "/css/style.css")) &body body)
+ `(spinneret:with-html-string
+ (:doctype)
+ (:head
+ (:title ,title)
+ (:meta :charset "UTF-8")
+ (:meta :name "viewport" :content "width=device-width, initial-scale=1.0")
+ (:link :rel "stylesheet" :href ,csspath))
+ (:body
+ ,@body)))
+
diff --git a/site/login.lisp b/site/login.lisp
index 14852c3..0310fe8 100644
--- a/site/login.lisp
+++ b/site/login.lisp
@@ -1,6 +1,6 @@
(in-package #:vampire)
-(wknd:defendpoint login
+(wknd:defendpoint login.html
:get :route "login"
:returns "text/html"
:handle (login-page))
@@ -13,7 +13,7 @@
:properties
(user user)
:authenticate (authenticate-login-user name password)
- :handle (wknd:endpoint-redirect 'home))
+ :handle (wknd:endpoint-redirect 'home.html))
(defun authenticate-login-user (name password)
(do>
@@ -23,7 +23,7 @@
session := (db:with-transaction () (make-instance 'session :user found-user))
(wknd:set-cookie +session-cookie+ :value (key session))))
-(wknd:defendpoint new-account-page
+(wknd:defendpoint new-account.html
:get :route "new-account"
:returns "text/html"
:handle (new-account-page))
@@ -47,26 +47,25 @@
(decf (uses-remaining invite)))
(let ((user (make-instance 'user :name username)))
(setf (user-pwhash user) (hash-string password (user-pwsalt user)))))
- (wknd:endpoint-redirect 'login)))
+ (wknd:endpoint-redirect 'login.html)))
(defun login-page ()
- (with-html-string
+ (page (:title "V A M P I R E ~ LOGIN")
(:div (:h1 "I vant to suck your blood")
- (:form :method "POST" :action "/login"
- (:input :placeholder "Name" :name "name")
- (:br)
- (:input :placeholder "Password" :type "password" :name "password")
- (:br)
- (:button :type "submit" "Click to Login")))
- (:a :href "/new-account" "Come to the Dark Side")))
+ (:form :method "POST" :action "/login"
+ (:input :placeholder "Name" :name "name")
+ (:br)
+ (:input :placeholder "Password" :type "password" :name "password")
+ (:br)
+ (:button :type "submit" "Click to Login")))))
(defun new-account-page ()
- (with-html-string
+ (page (:title "V A M P I R E ~ JOIN")
(:form :method "POST" :action "/new-account"
- (:input :placeholder "Invite Code" :name "invite-code")(:br)
- (:input :placeholder "Username" :name "username")(:br)
- (:input :placeholder "Password" :name "password" :type "password")(:br)
- (:input :placeholder "Repeat Password" :name "password2" :type "password")(:br)
- (:button :type "submit" "Become Undead"))))
+ (:input :placeholder "Invite Code" :name "invite-code")(:br)
+ (:input :placeholder "Username" :name "username")(:br)
+ (:input :placeholder "Password" :name "password" :type "password")(:br)
+ (:input :placeholder "Repeat Password" :name "password2" :type "password")(:br)
+ (:button :type "submit" "Become Undead"))))
diff --git a/vampire.asd b/vampire.asd
index 3b82f1c..0394b3a 100644
--- a/vampire.asd
+++ b/vampire.asd
@@ -29,13 +29,15 @@
(:module "site/"
:serial t
:components(
+ (:file "css")
+ (:file "html")
+ (:file "user-known")
+ (:file "login")
+ (:file "home")
;;(:file "navigation")
;;(:file "about")
;;(:file "new-account")
;;(:file "explore")
- (:file "user-known")
- (:file "login")
- (:file "home")
;;(:file "playlist")
))
(:file "vampire")