aHA the html is also configurable and so needs to be passed through

This commit is contained in:
Tessa Kelly 2022-03-23 16:12:57 -07:00
parent 84b21dc35a
commit 4bba00573e

View File

@ -80,6 +80,7 @@ generateEllieLink example code =
[]
[ Url.Builder.string "title" example.name
, Url.Builder.string "elmcode" (generateElmExampleModule example code)
, Url.Builder.string "htmlcode" ellieHtmlSetup
, -- TODO: a system will be required to keep these values in line with the elm json values
Url.Builder.string "packages" "elm/core@1.0.5"
, Url.Builder.string "packages" "elm/html@1.0.0"
@ -99,6 +100,7 @@ generateElmExampleModule exampleData code =
, "import Nri.Ui.UiIcon.V1 as UiIcon"
, "import " ++ Example.fullName exampleData ++ " as " ++ exampleData.name
, ""
, "main : RootHtml.Html msg"
, "main ="
, " " ++ code
, " |> toUnstyled"
@ -107,6 +109,20 @@ generateElmExampleModule exampleData code =
|> String.replace "\t" " "
ellieHtmlSetup : String
ellieHtmlSetup =
"""
<html> <head></head>
<body>
<main></main>
<script>
var app = Elm.Main.init({ node: document.querySelector('main') })
</script>
</body>
</html>
"""
viewSection : String -> List (Html msg) -> Html msg
viewSection name children =
section [ css [ flex (int 1) ] ]