-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move things around and finish README/examples
- Loading branch information
Showing
8 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Basic - Declarativ Examples</title> | ||
</head> | ||
<body> | ||
<div id="render-target"></div> | ||
<script type="text/javascript" src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script> | ||
<script type="text/javascript" src="../dist/declarativ.js"></script> | ||
<script> | ||
const { wrapCompose, compose, renderElement, elements: el } = declarativ; | ||
|
||
function article(title, body) { | ||
return el.article( | ||
el.h2(title), | ||
el.p(body) | ||
); | ||
} | ||
|
||
const bigHeader = wrapCompose(el.h1().attr("style", "font-size: 3em;")); | ||
|
||
const center = compose((inner) => `<center>${inner}</center>`); | ||
|
||
renderElement( | ||
$("#render-target"), | ||
el.div( | ||
center( | ||
bigHeader("My Blog!"), | ||
el.p("This is my blog, where I post my blog posts.") | ||
), | ||
el.hr(), | ||
article( | ||
"Why Cream Tea is far superior to a Tea Sandwich", | ||
[ | ||
"The cream. I just love the cream. I can't live without it. It consumes me. ", | ||
el.a("Look at this cream.").attr("href", "https://en.wikipedia.org/wiki/Cream_tea#/media/File:Cornish_cream_tea_2.jpg") | ||
] | ||
) | ||
) | ||
); | ||
</script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters