Skip to content

Commit 00e559a

Browse files
committed
Add template example
1 parent f6e83e1 commit 00e559a

16 files changed

Lines changed: 170 additions & 2 deletions

File tree

examples/blog/app/_layout/default.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
html {
33
head {
44
title "My awesome blog"
5+
meta charset: 'utf-8'
6+
meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
7+
link rel: "stylesheet", type: "text/css", href: "/assets/style.css"
58
}
69
body {
710
render_children(**props)

examples/blog/app/assets/style.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
body {
2+
max-width: 800px;
3+
margin: 4em auto;
4+
5+
font-family: sans-serif;
6+
/*Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro,
7+
sans-serif;*/
8+
9+
big {
10+
display: block;
11+
font-weight: bold;
12+
font-size: 10em;
13+
}
14+
}
15+
16+
@media (max-width: 768px) {
17+
body {
18+
margin-inline: 1em;
19+
}
20+
}

examples/blog/app/index.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
layout = import '_layout/default'
22

33
export layout.apply {
4-
p {
5-
a 'Blog posts', href: '/posts'
4+
div(style: 'text-align: center; font-size: 2em; font-weight: normal') {
5+
h1 {
6+
a(
7+
'Syntropy',
8+
style: 'color: #238',
9+
href: 'https://github.com/digital-fabric/syntropy',
10+
target: 'none'
11+
)
12+
}
13+
p {
14+
a 'Blog posts', href: '/posts'
15+
}
616
}
717
}

examples/blog/app/test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
layout = import '_layout/default'
2+
3+
export layout.apply {
4+
p {
5+
span "Hello!"
6+
}
7+
}

examples/template/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Gemfile.lock
2+
storage/*

examples/template/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://gem.coop'
2+
3+
gem 'syntropy'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export template { |**props|
2+
html {
3+
head {
4+
title "My awesome Syntropy web app"
5+
meta charset: 'utf-8'
6+
meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
7+
link rel: "stylesheet", type: "text/css", href: "/assets/style.css"
8+
}
9+
body {
10+
render_children(**props)
11+
auto_refresh!
12+
}
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export self
2+
3+
def connection_pool
4+
@connection_pool ||= DB::ConnectionPool.new(@machine, @env[:config][:storage][:path], 4)
5+
end
6+
7+
def schema
8+
DB::Schema.new(module_loader: @module_loader, schema_root: '_schema')
9+
end
10+
11+
def migrate!
12+
schema.apply(connection_pool)
13+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export ->(db) {
2+
# db.execute <<~SQL
3+
# create table posts (
4+
# id integer primary key autoincrement,
5+
# title text,
6+
# body text
7+
# )
8+
# SQL
9+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
* {
2+
border: 0;
3+
font: inherit;
4+
font-size: 100%;
5+
vertical-align: baseline;
6+
line-height: 1.5em;
7+
margin: 0;
8+
padding: 0;
9+
background-color: #f8f8f8;
10+
color: #222;
11+
}
12+
13+
body {
14+
max-width: 800px;
15+
margin: 4em auto;
16+
17+
font-size: 1.5em;
18+
font-family: sans-serif;
19+
}
20+
21+
@media (max-width: 768px) {
22+
body {
23+
margin-inline: 1em;
24+
}
25+
}

0 commit comments

Comments
 (0)