Initial commit
This commit is contained in:
commit
2628570daf
7 changed files with 190 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
bin/
|
||||
elm-stuff/
|
||||
public/elm.js
|
39
Makefile
Normal file
39
Makefile
Normal file
|
@ -0,0 +1,39 @@
|
|||
.PHONY: all node-deps clean run
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
PLATFORM = mac
|
||||
else
|
||||
PLATFORM = linux
|
||||
endif
|
||||
|
||||
TARGET=public/elm.js
|
||||
SOURCE=src/App.elm
|
||||
|
||||
ELM_FILES = $(shell find src -type f -name '*.elm')
|
||||
ELM = ./bin/elm
|
||||
|
||||
ELMMAKE_FLAGS =
|
||||
ifeq ($(DEBUG),1)
|
||||
ELMMAKE_FLAGS += --debug
|
||||
endif
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(ELM):
|
||||
mkdir -p ./bin
|
||||
curl -sL https://github.com/elm/compiler/releases/download/0.19.1/binary-for-$(PLATFORM)-64-bit.gz \
|
||||
| gunzip > $@
|
||||
chmod +x $@
|
||||
|
||||
$(TARGET): $(ELM_FILES) $(ELM)
|
||||
$(ELM) make $(ELMMAKE_FLAGS) $(SOURCE) --output $@
|
||||
|
||||
clean-deps:
|
||||
rm -rf bin
|
||||
rm -rf elm-stuff
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
rm -f $(ELM)
|
||||
rm -rf elm-stuff/build-artifacts
|
25
elm.json
Normal file
25
elm.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"type": "application",
|
||||
"source-directories": [
|
||||
"src"
|
||||
],
|
||||
"elm-version": "0.19.1",
|
||||
"dependencies": {
|
||||
"direct": {
|
||||
"elm/browser": "1.0.2",
|
||||
"elm/core": "1.0.5",
|
||||
"elm/html": "1.0.0",
|
||||
"mdgriffith/elm-ui": "1.1.8"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/json": "1.1.3",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/url": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.3"
|
||||
}
|
||||
},
|
||||
"test-dependencies": {
|
||||
"direct": {},
|
||||
"indirect": {}
|
||||
}
|
||||
}
|
BIN
public/Chicago.woff
Normal file
BIN
public/Chicago.woff
Normal file
Binary file not shown.
6
public/chicago.css
Normal file
6
public/chicago.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
@font-face {
|
||||
font-family: 'Chicago Plain';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Chicago Plain'), url('Chicago.woff') format('woff');
|
||||
}
|
17
public/index.html
Normal file
17
public/index.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Past Tense Clock</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="text/javascript" src="/elm.js"></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="chicago.css">
|
||||
</head>
|
||||
<meta charset="utf-8"/>
|
||||
<body>
|
||||
<div id="editor"></div>
|
||||
<script type="text/javascript">
|
||||
var app = Elm.App.init({node: document.getElementById("editor")});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
100
src/App.elm
Normal file
100
src/App.elm
Normal file
|
@ -0,0 +1,100 @@
|
|||
module App exposing (main, update, view)
|
||||
|
||||
import Browser
|
||||
import Element
|
||||
import Element.Background as Background
|
||||
import Element.Border as Border
|
||||
import Element.Font as Font
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ day : String
|
||||
, date : String
|
||||
, temperature : Int
|
||||
}
|
||||
|
||||
|
||||
type Msg
|
||||
= Update (List String) String
|
||||
|
||||
|
||||
init : Model
|
||||
init =
|
||||
{ day = "Friday"
|
||||
, date = "8/30/24"
|
||||
, temperature = 15
|
||||
}
|
||||
|
||||
|
||||
main =
|
||||
Browser.sandbox { init = init, update = update, view = view }
|
||||
|
||||
|
||||
update msg model =
|
||||
model
|
||||
|
||||
|
||||
view model =
|
||||
let
|
||||
box borderWidth child =
|
||||
Element.el
|
||||
[ Border.color <| Element.rgb 255 255 255
|
||||
, Border.width borderWidth
|
||||
, Border.rounded 35
|
||||
]
|
||||
child
|
||||
|
||||
display label size value =
|
||||
Element.column [ Element.centerY, Font.size size ]
|
||||
[ Element.el
|
||||
[ Font.color <| Element.rgb 255 255 255
|
||||
, Font.size 16
|
||||
, Element.centerX
|
||||
, Element.height <| Element.px 16
|
||||
]
|
||||
<|
|
||||
Element.text label
|
||||
, box 3 <| Element.el [ Element.paddingXY 30 8 ] <| Element.text value
|
||||
]
|
||||
|
||||
bars =
|
||||
let
|
||||
bar =
|
||||
Element.el
|
||||
[ Border.color <| Element.rgb 255 255 255
|
||||
, Border.width 3
|
||||
, Border.rounded 25
|
||||
, Element.width <| Element.px 20
|
||||
, Element.height <| Element.px 52
|
||||
]
|
||||
Element.none
|
||||
in
|
||||
Element.column
|
||||
[ Element.paddingEach { top = 18, right = 20, bottom = 0, left = 20 }
|
||||
]
|
||||
[ Element.row [ Element.spacing 3 ] [ bar, bar, bar ]
|
||||
]
|
||||
in
|
||||
Element.layout
|
||||
[ Background.color <| Element.rgb 0 0 0
|
||||
, Element.padding 50
|
||||
, Font.color <| Element.rgb 255 0 0
|
||||
, Font.family [ Font.typeface "Chicago Plain" ]
|
||||
, Font.size 36
|
||||
]
|
||||
<|
|
||||
box 5 <|
|
||||
Element.column [ Element.paddingXY 15 25, Element.spacing 5 ]
|
||||
[ Element.row [ Element.centerY, Element.spacing 15 ]
|
||||
[ display "TODAY" 36 <| String.toUpper model.day
|
||||
, display "" 18 <|
|
||||
String.concat
|
||||
[ String.fromInt model.temperature
|
||||
, "°C"
|
||||
]
|
||||
]
|
||||
, Element.row [ Element.centerY, Element.spacing 15 ]
|
||||
[ bars
|
||||
, display "DATE" 36 <| String.toUpper model.date
|
||||
]
|
||||
]
|
Loading…
Reference in a new issue