Skip to content

Commit b2f6abc

Browse files
committed
Use speakeasy static site generator
1 parent 8413471 commit b2f6abc

17 files changed

+343
-277
lines changed

Vagrantfile

-29
This file was deleted.

css/tailwind.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/app.janet

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(import joy :prefix "")
2+
3+
(route :get "/" :home)
4+
5+
(defn home [request]
6+
(text/plain "You found joy!"))
7+
8+
(def app (app))
9+
10+
(server app 9001)

examples/controller.janet

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(use joy)
2+
3+
4+
(route :get "/todos/new" :new)
5+
(route :post "/todos" :create)
6+
7+
8+
(def todo
9+
(body :todos
10+
(validates :name :required true)
11+
(permit :name :finished)))
12+
13+
14+
(defn new [request &opt errors]
15+
(default errors {})
16+
17+
(let [todo (todo request)]
18+
19+
(form-for [request :create]
20+
(text-field todo :name)
21+
[:div (errors :name)]
22+
23+
(label-for :finished
24+
# generates hidden input for false/zero values
25+
(checkbox-field todo :finished)
26+
[:span " Finished"])
27+
[:div (errors :finished)]
28+
29+
(submit "Save"))))
30+
31+
32+
(defn create [request]
33+
(let [todo (-> request todo db/save)]
34+
35+
(if (saved? todo)
36+
(redirect-to :home)
37+
(new request (errors todo)))))

examples/css.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1 class="text-2xl text-gray-400">You found joy!</h1>

examples/css.janet

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[:h1.text-2xl.text-gray-400
2+
"You found joy!"]

examples/css1.janet

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(def h1 :h1.text-2xl.text-gray-400)
2+
3+
[h1 "You found joy!"]

examples/form.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<form>
2+
<input type="text" placeholder="Your name" />
3+
<input type="email" placeholder="Your email" />
4+
<input type="submit" value="Submit" />
5+
</form>

examples/form.janet

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[:form
2+
[:input {:type "text" :placeholder "Your name"}]
3+
[:input {:type "email" :placeholder "Your email"}]
4+
[:input {:type "submit" :value "Submit"}]]

examples/loop.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li>eggs</li>
3+
<li>milk</li>
4+
<li>tomatoes</li>
5+
</ul>

examples/loop.janet

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(let [groceries [{:name "eggs"}
2+
{:name "milk"}
3+
{:name "tomatoes"}]]
4+
[:ul
5+
(foreach [g groceries]
6+
[:li (g :name)])])

html.janet

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(defn class [el & args]
2+
(keyword el ;(map |(string "." $) args)))
3+
4+
(def container :div.lg:w-2/3.p-4.mx-auto)
5+
6+
(def h1 :h1.text-5xl.text-gray-800)
7+
(def h2 :h2.text-3xl.tracking-tight.text-gray-800)
8+
(def h3 :h3.text-2xl.text-gray-800)
9+
(def h4 :h4.text-l.text-gray-800)
10+
11+
(def list :div.divide-y-2.divide-gray-200)
12+
(def hstack :div.self-stretch.flex-row.lg:flex)
13+
(def hstack:md (class hstack :lg:space-x-4))
14+
(def vstack :div.self-stretch.flex-col.flex-1)
15+
(def vstack:sm (class vstack :space-y-2))
16+
(def vstack:md (class vstack :space-y-4))
17+
(def vstack:lg (class vstack :space-y-16))
18+
(def spacer :div.flex-1)
19+
20+
(def cta :a.inline-block.my-6.px-5.py-3.rounded-lg.bg-indigo-500.text-white.shadow-lg.hover:bg-indigo-700)
21+
22+
(def mt-4 :div.mt-4)
23+
(def mt-10 :div.lg:mt-10)
24+
(def mt-16 :div.lg:mt-16)
25+
(def space-y-4 :div.space-y-4)
26+
27+
(def pre :pre.flex-1)
28+
(def code :code.rounded-lg.p-6)
29+
30+
(def install-container :div.bg-gray-100.py-4.mt-6)
31+
(def install-instruction :div.mt-2.inline-block.rounded-lg.border.border-gray-500.p-2)
32+
33+
(def text:light :div.text-gray-600)
34+
(def text :div.text-gray-800.flex-1)
35+
36+
(def link :a.text-indigo-500.underline)

0 commit comments

Comments
 (0)