Compare commits
No commits in common. "b903f3755d041e20bf7b18a8f1bfb3feda985ac3" and "d90d3484eb41bcf2fcda89967abb9c68b1080c1f" have entirely different histories.
b903f3755d
...
d90d3484eb
6 changed files with 3 additions and 104 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -12,7 +12,3 @@ result-*
|
||||||
|
|
||||||
# Ignore automatically generated direnv output
|
# Ignore automatically generated direnv output
|
||||||
.direnv
|
.direnv
|
||||||
|
|
||||||
# ---> Project
|
|
||||||
# Ignore compiled elm files
|
|
||||||
compiled
|
|
||||||
|
|
3
elm.json
3
elm.json
|
@ -8,8 +8,7 @@
|
||||||
"direct": {
|
"direct": {
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
"elm/html": "1.0.0",
|
"elm/html": "1.0.0"
|
||||||
"mdgriffith/elm-ui": "1.1.8"
|
|
||||||
},
|
},
|
||||||
"indirect": {
|
"indirect": {
|
||||||
"elm/json": "1.1.3",
|
"elm/json": "1.1.3",
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
elmPackages.elm
|
elmPackages.elm
|
||||||
elmPackages.elm-test
|
elmPackages.elm-test
|
||||||
elmPackages.elm-format
|
elmPackages.elm-format
|
||||||
entr
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
81
src/Main.elm
81
src/Main.elm
|
@ -1,82 +1,5 @@
|
||||||
module Main exposing (main)
|
module Main exposing (main)
|
||||||
|
|
||||||
import Browser
|
import Html exposing (text)
|
||||||
import Browser.Events as Events
|
|
||||||
import Element exposing (..)
|
|
||||||
import Element.Background as Background
|
|
||||||
import Element.Font as Font
|
|
||||||
import Html exposing (Html)
|
|
||||||
|
|
||||||
|
main = text "Hello, world!"
|
||||||
main : Program Flags Model Msg
|
|
||||||
main =
|
|
||||||
Browser.document { init = init, update = update, subscriptions = subscribe, view = view }
|
|
||||||
|
|
||||||
|
|
||||||
type alias Model =
|
|
||||||
{ w : Int, h : Int }
|
|
||||||
|
|
||||||
|
|
||||||
type alias Flags =
|
|
||||||
( Int, Int )
|
|
||||||
|
|
||||||
|
|
||||||
init : Flags -> ( Model, Cmd Msg )
|
|
||||||
init flags =
|
|
||||||
case flags of
|
|
||||||
( width, height ) ->
|
|
||||||
( { w = width, h = height }, Cmd.none )
|
|
||||||
|
|
||||||
|
|
||||||
type Msg
|
|
||||||
= Resize Int Int
|
|
||||||
|
|
||||||
|
|
||||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
|
||||||
update msg model =
|
|
||||||
case msg of
|
|
||||||
Resize width height ->
|
|
||||||
( { model | w = width, h = height }, Cmd.none )
|
|
||||||
|
|
||||||
|
|
||||||
subscribe : Model -> Sub Msg
|
|
||||||
subscribe _ =
|
|
||||||
Events.onResize Resize
|
|
||||||
|
|
||||||
|
|
||||||
htmlify : List (Element Msg) -> List (Html Msg)
|
|
||||||
htmlify =
|
|
||||||
List.map (Element.layout [])
|
|
||||||
|
|
||||||
|
|
||||||
vw : Model -> Float -> Float
|
|
||||||
vw model percent =
|
|
||||||
Basics.toFloat model.w * percent / 100
|
|
||||||
|
|
||||||
|
|
||||||
vh : Model -> Float -> Float
|
|
||||||
vh model percent =
|
|
||||||
Basics.toFloat model.h * percent / 100
|
|
||||||
|
|
||||||
|
|
||||||
view : Model -> Browser.Document Msg
|
|
||||||
view model =
|
|
||||||
{ title = "MacGregor House"
|
|
||||||
, body =
|
|
||||||
htmlify
|
|
||||||
[ el
|
|
||||||
[ width fill
|
|
||||||
, height fill
|
|
||||||
, Background.color (rgb255 0 0 0)
|
|
||||||
]
|
|
||||||
(el
|
|
||||||
[ alignLeft
|
|
||||||
, alignTop
|
|
||||||
, moveRight (vw model 10)
|
|
||||||
, moveDown (vh model 50)
|
|
||||||
, Font.color (rgb255 255 255 255)
|
|
||||||
]
|
|
||||||
(text "MacGregor House")
|
|
||||||
)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<title>MacGregor House</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script src="../result/Main.js"></script>
|
|
||||||
<script>
|
|
||||||
var app = Elm.Main.init({
|
|
||||||
node: document.getElementById("app"),
|
|
||||||
flags: [window.innerWidth, window.innerHeight],
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
1
watch.sh
1
watch.sh
|
@ -1 +0,0 @@
|
||||||
find src/ | entr -r elm make src/Main.elm --output compiled/Main.js
|
|
Loading…
Add table
Add a link
Reference in a new issue