git.iko.soy/rowtype-yoga/purescript-yoga-react-dom
on main help sign in
36 lines 1.2 kB history raw
1module Test.Main where
3import Prelude
4import Yoga.React.DOM.HTML as H
5import Effect (Effect)
6import Effect.Class.Console (log)
7import Yoga.React.DOM.Server (renderToStaticMarkup, renderToString)
8import Yoga.React.DOM.HTML.Tfoot (tfoot)
9import React.Basic (JSX)
10import Yoga.React.DOM.Internal (text)
11import Yoga.React.DOM.HTML.Blockquote (blockquote) as H
12import Node.FS.Aff (writeTextFile)
13import Effect.Aff (launchAff_)
14import Node.Encoding (Encoding(UTF8))
15import Example (mkExample)
17main :: Effect Unit
18main = do
19 exampleApp <- mkExample
20 launchAff_ do
21 writeTextFile UTF8 "index.html" (renderToStaticMarkup (example exampleApp))
23example :: ({} -> JSX) -> JSX
24example exampleApp = H.html {}
25 [ H.head {}
26 [ H.title "My Web Page"
27 , H.meta { charSet: "UTF-8" }
28 , H.meta { name: "viewport", content: "width=device-width, initial-scale=1.0" }
29 , H.link { rel: "stylesheet", href: "styles.css" }
30 , H.style {} "body { background-color: #f0f0f2; }"
31 , H.script { src: "https://cdn.tailwindcss.com" }
32 , H.body { className: "w-full" } $
33 H.div_ { id: "react-root", dangerouslySetInnerHTML: { __html: renderToString $ exampleApp {} } }
34 , H.script { src: "index.js" }
35 ]
36 ]