commit 2628570dafac88fd088328af48bfff149d31fccc Author: Correl Roush Date: Wed Aug 28 17:10:25 2024 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..809bf74 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin/ +elm-stuff/ +public/elm.js diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6a1dbaf --- /dev/null +++ b/Makefile @@ -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 diff --git a/elm.json b/elm.json new file mode 100644 index 0000000..5398be3 --- /dev/null +++ b/elm.json @@ -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": {} + } +} diff --git a/public/Chicago.woff b/public/Chicago.woff new file mode 100644 index 0000000..240fd3e Binary files /dev/null and b/public/Chicago.woff differ diff --git a/public/chicago.css b/public/chicago.css new file mode 100644 index 0000000..1e53b62 --- /dev/null +++ b/public/chicago.css @@ -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'); +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..d975332 --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + Past Tense Clock + + + + + + + + +
+ + + diff --git a/src/App.elm b/src/App.elm new file mode 100644 index 0000000..2c1d830 --- /dev/null +++ b/src/App.elm @@ -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 + ] + ]