From 1f85f8145d0209c6ce7a7be2e7b280bcf6475b9c Mon Sep 17 00:00:00 2001 From: didier amyot Date: Fri, 12 Jan 2024 21:14:30 -0500 Subject: [PATCH] cours d'aujourd hui --- dom/index.html | 19 +++++++++++++++++++ mithril-example/index.html | 21 +++++++++++++++++++++ mithril-example/main.js | 28 ++++++++++++++++++++++++++++ mithril-example/style.css | 15 +++++++++++++++ svg/index.html | 21 +++++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 dom/index.html create mode 100644 mithril-example/index.html create mode 100644 mithril-example/main.js create mode 100644 mithril-example/style.css create mode 100644 svg/index.html diff --git a/dom/index.html b/dom/index.html new file mode 100644 index 0000000..cdc8723 --- /dev/null +++ b/dom/index.html @@ -0,0 +1,19 @@ + + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/mithril-example/index.html b/mithril-example/index.html new file mode 100644 index 0000000..87f4c8f --- /dev/null +++ b/mithril-example/index.html @@ -0,0 +1,21 @@ + + + + + + + Document + + + + + +
+ +
+ +
+ + + \ No newline at end of file diff --git a/mithril-example/main.js b/mithril-example/main.js new file mode 100644 index 0000000..245ca4e --- /dev/null +++ b/mithril-example/main.js @@ -0,0 +1,28 @@ +import m from "https://esm.sh/mithril@2.2.2" + +function example1(){ + let div1 = m("b", {style: "font-family: monospace;"}, "didier"); + let div2 = m("div", "bonjour monde"); + + return m("div", {style: "color:red;"}, "bonjour", " ", div1); +} + +m.render(document.getElementById("example-1"), example1()); + + +function example2(){ + let chien = m("li", "un chien"); + let chat = m("li", ["un ", m("a", {href: "https://example.com/chat"}, "chat")]); + return m("ul", [chien, chat]); +} + +m.render(document.getElementById("example-2"), example2()); + + +function example3(){ + let rougeEtGros = m("div.red.big", "Rouge & Gros"); + let blueEtPetit = m("div.blue.small", "Bleu & Petit"); + return m("div", [rougeEtGros, blueEtPetit]); +} + +m.render(document.getElementById("example-3"), example3()); diff --git a/mithril-example/style.css b/mithril-example/style.css new file mode 100644 index 0000000..4bfcdc4 --- /dev/null +++ b/mithril-example/style.css @@ -0,0 +1,15 @@ +.blue{ + color: blue; +} + +.red{ + color: red; +} + +.big{ + font-size: 1.8em; +} + +.small{ + font-size: 0.7em; +} \ No newline at end of file diff --git a/svg/index.html b/svg/index.html new file mode 100644 index 0000000..d23b53c --- /dev/null +++ b/svg/index.html @@ -0,0 +1,21 @@ + + + + + + + Document + + + + + + + + + + + + + \ No newline at end of file