From 7391b309546d7647f8b939bc3e57d54ee8ffbf86 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Tue, 27 Mar 2018 20:36:08 -0700 Subject: [PATCH 1/4] Initial commit with single file modules --- Main.elm | 15 -- Model.elm | 26 --- Update.elm | 27 --- elm-package.json | 2 +- elmoji-translator-hello-world/HelloWorld.elm | 69 +++++++ elmoji-translator-release-0/Main.elm | 84 +++++++++ elmoji-translator-release-1/Main.elm | 86 +++++++++ elmoji-translator-release-2/Main.elm | 97 ++++++++++ elmoji-translator-release-3-part-1/Main.elm | 118 ++++++++++++ elmoji-translator-release-3-part-2/Main.elm | 136 ++++++++++++++ elmoji-translator-release-4-part-1/Main.elm | 167 +++++++++++++++++ elmoji-translator-release-4-part-2/Main.elm | 174 ++++++++++++++++++ .../Main.elm | 101 ++++++++-- 13 files changed, 1018 insertions(+), 84 deletions(-) delete mode 100644 Main.elm delete mode 100644 Model.elm delete mode 100644 Update.elm create mode 100755 elmoji-translator-hello-world/HelloWorld.elm create mode 100755 elmoji-translator-release-0/Main.elm create mode 100755 elmoji-translator-release-1/Main.elm create mode 100755 elmoji-translator-release-2/Main.elm create mode 100755 elmoji-translator-release-3-part-1/Main.elm create mode 100755 elmoji-translator-release-3-part-2/Main.elm create mode 100755 elmoji-translator-release-4-part-1/Main.elm create mode 100755 elmoji-translator-release-4-part-2/Main.elm rename View.elm => elmoji-translator-release-4-part-3/Main.elm (64%) mode change 100644 => 100755 diff --git a/Main.elm b/Main.elm deleted file mode 100644 index 282250f..0000000 --- a/Main.elm +++ /dev/null @@ -1,15 +0,0 @@ -module Main exposing (..) - -import Html -import View -import Model -import Update - - -main : Program Never Model.Model Update.Msg -main = - Html.beginnerProgram - { model = Model.init - , view = View.view - , update = Update.update - } diff --git a/Model.elm b/Model.elm deleted file mode 100644 index 18fcbd1..0000000 --- a/Model.elm +++ /dev/null @@ -1,26 +0,0 @@ -module Model exposing (..) - - -type Direction - = TextToEmoji - | EmojiToText - - -type alias Model = - { currentText : String - , direction : Direction - , selectedKey : String - } - - -init : Model -init = - { currentText = "" - , direction = TextToEmoji - , selectedKey = defaultKey - } - - -defaultKey : String -defaultKey = - "😳" diff --git a/Update.elm b/Update.elm deleted file mode 100644 index ace84e1..0000000 --- a/Update.elm +++ /dev/null @@ -1,27 +0,0 @@ -module Update exposing (..) - -import Model - - -type Msg - = SetCurrentText String - | SetSelectedKey String - | ToggleDirection - - -update : Msg -> Model.Model -> Model.Model -update msg model = - case msg of - SetCurrentText newText -> - { model | currentText = newText } - - SetSelectedKey newKey -> - { model | selectedKey = newKey } - - ToggleDirection -> - case model.direction of - Model.TextToEmoji -> - { model | direction = Model.EmojiToText } - - Model.EmojiToText -> - { model | direction = Model.TextToEmoji } diff --git a/elm-package.json b/elm-package.json index b9b1e74..16c0ad4 100644 --- a/elm-package.json +++ b/elm-package.json @@ -8,7 +8,7 @@ ], "exposed-modules": [], "dependencies": { - "elm-community/list-extra": "6.0.0 <= v < 7.0.0", + "elm-community/list-extra": "7.1.0 <= v < 8.0.0", "elm-lang/core": "5.1.1 <= v < 6.0.0", "elm-lang/html": "2.0.0 <= v < 3.0.0" }, diff --git a/elmoji-translator-hello-world/HelloWorld.elm b/elmoji-translator-hello-world/HelloWorld.elm new file mode 100755 index 0000000..5f367af --- /dev/null +++ b/elmoji-translator-hello-world/HelloWorld.elm @@ -0,0 +1,69 @@ +module HelloWorld exposing (..) + +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + { buttonLabel : String } + + +init : Model +init = + { buttonLabel = "hello world!" } + + + +-- UPDATE + + +type Msg + = ChangeText + + +update : Msg -> Model -> Model +update msg model = + case msg of + ChangeText -> + if model.buttonLabel == "hello world!" then + { model | buttonLabel = "goodbye world!" } + else + { model | buttonLabel = "hello world!" } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [ Html.Attributes.class "skeleton-elm-project" ] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.div + [ Html.Attributes.class "waves-effect waves-light btn-large" + , Html.Events.onClick ChangeText + ] + [ Html.text model.buttonLabel ] + ] diff --git a/elmoji-translator-release-0/Main.elm b/elmoji-translator-release-0/Main.elm new file mode 100755 index 0000000..03ea7a7 --- /dev/null +++ b/elmoji-translator-release-0/Main.elm @@ -0,0 +1,84 @@ +module Main exposing (..) + +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + { currentText : String } + + +init : Model +init = + { currentText = "" } + + + +-- UPDATE + + +type Msg + = SetCurrentText String + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + -- currently, this does nothing! + model + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + ] + ] diff --git a/elmoji-translator-release-1/Main.elm b/elmoji-translator-release-1/Main.elm new file mode 100755 index 0000000..a2d3f0c --- /dev/null +++ b/elmoji-translator-release-1/Main.elm @@ -0,0 +1,86 @@ +module Main exposing (..) + +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + { currentText : String } + + +init : Model +init = + { currentText = "" } + + + +-- UPDATE + + +type Msg + = SetCurrentText String + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text model.currentText ] + ] + ] diff --git a/elmoji-translator-release-2/Main.elm b/elmoji-translator-release-2/Main.elm new file mode 100755 index 0000000..073e6dc --- /dev/null +++ b/elmoji-translator-release-2/Main.elm @@ -0,0 +1,97 @@ +module Main exposing (..) + +import EmojiConverter +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + { currentText : String } + + +init : Model +init = + { currentText = "" } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text (translateText model) ] + ] + ] + + +translateText : Model -> String +translateText model = + EmojiConverter.textToEmoji defaultKey model.currentText diff --git a/elmoji-translator-release-3-part-1/Main.elm b/elmoji-translator-release-3-part-1/Main.elm new file mode 100755 index 0000000..d18027c --- /dev/null +++ b/elmoji-translator-release-3-part-1/Main.elm @@ -0,0 +1,118 @@ +module Main exposing (..) + +import EmojiConverter +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + { currentText : String } + + +init : Model +init = + { currentText = "" } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + | ToggleDirection + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + ToggleDirection -> + -- currently, this does nothing! + model + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.div + [ Html.Attributes.class "switch center" ] + [ Html.label + [] + [ Html.text "Translate Text" + , Html.input + [ Html.Attributes.type_ "checkbox" + , Html.Events.onClick ToggleDirection + ] + [] + , Html.span + [ Html.Attributes.class "lever" ] + [] + , Html.text "Translate Emoji" + ] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text (translateText model) ] + ] + ] + + +translateText : Model -> String +translateText model = + EmojiConverter.textToEmoji defaultKey model.currentText diff --git a/elmoji-translator-release-3-part-2/Main.elm b/elmoji-translator-release-3-part-2/Main.elm new file mode 100755 index 0000000..520f6ae --- /dev/null +++ b/elmoji-translator-release-3-part-2/Main.elm @@ -0,0 +1,136 @@ +module Main exposing (..) + +import EmojiConverter +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type Direction + = TextToEmoji + | EmojiToText + + +type alias Model = + { currentText : String + , direction : Direction + } + + +init : Model +init = + { currentText = "" + , direction = TextToEmoji + } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + | ToggleDirection + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + ToggleDirection -> + case model.direction of + TextToEmoji -> + { model | direction = EmojiToText } + + EmojiToText -> + { model | direction = TextToEmoji } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.div + [ Html.Attributes.class "switch center" ] + [ Html.label + [] + [ Html.text "Translate Text" + , Html.input + [ Html.Attributes.type_ "checkbox" + , Html.Events.onClick ToggleDirection + ] + [] + , Html.span + [ Html.Attributes.class "lever" ] + [] + , Html.text "Translate Emoji" + ] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text (translateText model) ] + ] + ] + + +translateText : Model -> String +translateText model = + case model.direction of + TextToEmoji -> + EmojiConverter.textToEmoji defaultKey model.currentText + + EmojiToText -> + EmojiConverter.emojiToText defaultKey model.currentText diff --git a/elmoji-translator-release-4-part-1/Main.elm b/elmoji-translator-release-4-part-1/Main.elm new file mode 100755 index 0000000..9626e92 --- /dev/null +++ b/elmoji-translator-release-4-part-1/Main.elm @@ -0,0 +1,167 @@ +module Main exposing (..) + +import EmojiConverter +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type Direction + = TextToEmoji + | EmojiToText + + +type alias Model = + { currentText : String + , direction : Direction + } + + +init : Model +init = + { currentText = "" + , direction = TextToEmoji + } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + | ToggleDirection + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + ToggleDirection -> + case model.direction of + TextToEmoji -> + { model | direction = EmojiToText } + + EmojiToText -> + { model | direction = TextToEmoji } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.div + [ Html.Attributes.class "switch center" ] + [ Html.label + [] + [ Html.text "Translate Text" + , Html.input + [ Html.Attributes.type_ "checkbox" + , Html.Events.onClick ToggleDirection + ] + [] + , Html.span + [ Html.Attributes.class "lever" ] + [] + , Html.text "Translate Emoji" + ] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text (translateText model) ] + ] + , Html.div + [ Html.Attributes.class "divider" ] + [] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.h4 + [ Html.Attributes.class "center" ] + [ Html.text "Select Your Key" ] + , renderKeys + ] + ] + + +translateText : Model -> String +translateText model = + case model.direction of + TextToEmoji -> + EmojiConverter.textToEmoji defaultKey model.currentText + + EmojiToText -> + EmojiConverter.emojiToText defaultKey model.currentText + + +renderKeys : Html.Html Msg +renderKeys = + Html.div + [ Html.Attributes.class "row" ] + (List.map (\emoji -> renderKey emoji) EmojiConverter.supportedEmojis) + + +renderKey : String -> Html.Html Msg +renderKey emoji = + Html.div + [ Html.Attributes.class "col s2 m1 emoji-size" ] + [ Html.div + [ Html.Attributes.classList + [ ( "key-selector", True ) + , ( "is-selected", emoji == defaultKey ) + ] + ] + [ Html.text emoji ] + ] diff --git a/elmoji-translator-release-4-part-2/Main.elm b/elmoji-translator-release-4-part-2/Main.elm new file mode 100755 index 0000000..2d5c727 --- /dev/null +++ b/elmoji-translator-release-4-part-2/Main.elm @@ -0,0 +1,174 @@ +module Main exposing (..) + +import EmojiConverter +import Html +import Html.Attributes +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type Direction + = TextToEmoji + | EmojiToText + + +type alias Model = + { currentText : String + , direction : Direction + , selectedKey : String + } + + +init : Model +init = + { currentText = "" + , direction = TextToEmoji + , selectedKey = defaultKey + } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + | SetSelectedKey String + | ToggleDirection + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + SetSelectedKey newKey -> + { model | selectedKey = newKey } + + ToggleDirection -> + case model.direction of + TextToEmoji -> + { model | direction = EmojiToText } + + EmojiToText -> + { model | direction = TextToEmoji } + + + +-- VIEW + + +view : Model -> Html.Html Msg +view model = + Html.div + [] + [ Html.node "link" + [ Html.Attributes.rel "stylesheet" + , Html.Attributes.href "stylesheets/main.css" + ] + [] + , Html.nav + [] + [ Html.div + [ Html.Attributes.class "nav-wrapper light-blue lighten-2" ] + [ Html.div + [ Html.Attributes.class "brand-logo center" ] + [ Html.text "Elmoji Translator" ] + ] + ] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.div + [ Html.Attributes.class "input-field" ] + [ Html.input + [ Html.Attributes.type_ "text" + , Html.Attributes.class "center" + , Html.Attributes.placeholder "Let's Translate!" + , Html.Events.onInput SetCurrentText + ] + [] + ] + , Html.div + [ Html.Attributes.class "switch center" ] + [ Html.label + [] + [ Html.text "Translate Text" + , Html.input + [ Html.Attributes.type_ "checkbox" + , Html.Events.onClick ToggleDirection + ] + [] + , Html.span + [ Html.Attributes.class "lever" ] + [] + , Html.text "Translate Emoji" + ] + ] + , Html.p + [ Html.Attributes.class "center output-text emoji-size" ] + [ Html.text (translateText model) ] + ] + , Html.div + [ Html.Attributes.class "divider" ] + [] + , Html.section + [ Html.Attributes.class "container" ] + [ Html.h4 + [ Html.Attributes.class "center" ] + [ Html.text "Select Your Key" ] + , renderKeys + ] + ] + + +translateText : Model -> String +translateText model = + case model.direction of + TextToEmoji -> + EmojiConverter.textToEmoji defaultKey model.currentText + + EmojiToText -> + EmojiConverter.emojiToText defaultKey model.currentText + + +renderKeys : Html.Html Msg +renderKeys = + Html.div + [ Html.Attributes.class "row" ] + (List.map (\emoji -> renderKey emoji) EmojiConverter.supportedEmojis) + + +renderKey : String -> Html.Html Msg +renderKey emoji = + Html.div + [ Html.Attributes.class "col s2 m1 emoji-size" ] + [ Html.div + [ Html.Attributes.classList + [ ( "key-selector", True ) + , ( "is-selected", emoji == defaultKey ) + ] + , Html.Events.onClick (SetSelectedKey emoji) + ] + [ Html.text emoji ] + ] diff --git a/View.elm b/elmoji-translator-release-4-part-3/Main.elm old mode 100644 new mode 100755 similarity index 64% rename from View.elm rename to elmoji-translator-release-4-part-3/Main.elm index 96cc942..e8a823b --- a/View.elm +++ b/elmoji-translator-release-4-part-3/Main.elm @@ -1,14 +1,85 @@ -module View exposing (..) +module Main exposing (..) -import Update -import Model +import EmojiConverter import Html -import Html.Events import Html.Attributes -import EmojiConverter +import Html.Events + + +-- MAIN + + +main : Program Never Model Msg +main = + Html.beginnerProgram + { model = init + , view = view + , update = update + } + + + +-- MODEL + + +type Direction + = TextToEmoji + | EmojiToText + + +type alias Model = + { currentText : String + , direction : Direction + , selectedKey : String + } + + +init : Model +init = + { currentText = "" + , direction = TextToEmoji + , selectedKey = defaultKey + } + + +defaultKey : String +defaultKey = + "😳" + + + +-- UPDATE + + +type Msg + = SetCurrentText String + | SetSelectedKey String + | ToggleDirection + + +update : Msg -> Model -> Model +update msg model = + case msg of + SetCurrentText newText -> + { model | currentText = newText } + + SetSelectedKey newKey -> + { model | selectedKey = newKey } + + ToggleDirection -> + case model.direction of + TextToEmoji -> + { model | direction = EmojiToText } + + EmojiToText -> + { model | direction = TextToEmoji } + + + +-- VIEW -view : Model.Model -> Html.Html Update.Msg +view : Model -> Html.Html Msg view model = Html.div [] @@ -34,7 +105,7 @@ view model = [ Html.Attributes.type_ "text" , Html.Attributes.class "center" , Html.Attributes.placeholder "Let's Translate!" - , Html.Events.onInput Update.SetCurrentText + , Html.Events.onInput SetCurrentText ] [] ] @@ -45,7 +116,7 @@ view model = [ Html.text "Translate Text" , Html.input [ Html.Attributes.type_ "checkbox" - , Html.Events.onClick Update.ToggleDirection + , Html.Events.onClick ToggleDirection ] [] , Html.span @@ -66,29 +137,29 @@ view model = [ Html.h4 [ Html.Attributes.class "center" ] [ Html.text "Select Your Key" ] - , (renderKeys model) + , renderKeys model ] ] -translateText : Model.Model -> String +translateText : Model -> String translateText model = case model.direction of - Model.TextToEmoji -> + TextToEmoji -> EmojiConverter.textToEmoji model.selectedKey model.currentText - Model.EmojiToText -> + EmojiToText -> EmojiConverter.emojiToText model.selectedKey model.currentText -renderKeys : Model.Model -> Html.Html Update.Msg +renderKeys : Model -> Html.Html Msg renderKeys model = Html.div [ Html.Attributes.class "row" ] (List.map (\emoji -> renderKey model emoji) EmojiConverter.supportedEmojis) -renderKey : Model.Model -> String -> Html.Html Update.Msg +renderKey : Model -> String -> Html.Html Msg renderKey model emoji = Html.div [ Html.Attributes.class "col s2 m1 emoji-size" ] @@ -97,7 +168,7 @@ renderKey model emoji = [ ( "key-selector", True ) , ( "is-selected", emoji == model.selectedKey ) ] - , Html.Events.onClick (Update.SetSelectedKey emoji) + , Html.Events.onClick (SetSelectedKey emoji) ] [ Html.text emoji ] ] From bfda2032d9a0511c9f4d56e6a20d0dc951ed1e0b Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Tue, 27 Mar 2018 20:50:43 -0700 Subject: [PATCH 2/4] moves Main.elm files into Part files --- elmoji-translator-hello-world/HelloWorld.elm => HelloWorld.elm | 0 elmoji-translator-release-0/Main.elm => Part1.elm | 2 +- elmoji-translator-release-1/Main.elm => Part2.elm | 2 +- elmoji-translator-release-2/Main.elm => Part3.elm | 2 +- elmoji-translator-release-3-part-1/Main.elm => Part4.elm | 2 +- elmoji-translator-release-3-part-2/Main.elm => Part5.elm | 2 +- elmoji-translator-release-4-part-1/Main.elm => Part6.elm | 2 +- elmoji-translator-release-4-part-2/Main.elm => Part7.elm | 2 +- elmoji-translator-release-4-part-3/Main.elm => Part8.elm | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename elmoji-translator-hello-world/HelloWorld.elm => HelloWorld.elm (100%) rename elmoji-translator-release-0/Main.elm => Part1.elm (98%) rename elmoji-translator-release-1/Main.elm => Part2.elm (98%) rename elmoji-translator-release-2/Main.elm => Part3.elm (98%) rename elmoji-translator-release-3-part-1/Main.elm => Part4.elm (98%) rename elmoji-translator-release-3-part-2/Main.elm => Part5.elm (99%) rename elmoji-translator-release-4-part-1/Main.elm => Part6.elm (99%) rename elmoji-translator-release-4-part-2/Main.elm => Part7.elm (99%) rename elmoji-translator-release-4-part-3/Main.elm => Part8.elm (99%) diff --git a/elmoji-translator-hello-world/HelloWorld.elm b/HelloWorld.elm similarity index 100% rename from elmoji-translator-hello-world/HelloWorld.elm rename to HelloWorld.elm diff --git a/elmoji-translator-release-0/Main.elm b/Part1.elm similarity index 98% rename from elmoji-translator-release-0/Main.elm rename to Part1.elm index 03ea7a7..3c7148c 100755 --- a/elmoji-translator-release-0/Main.elm +++ b/Part1.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part1 exposing (..) import Html import Html.Attributes diff --git a/elmoji-translator-release-1/Main.elm b/Part2.elm similarity index 98% rename from elmoji-translator-release-1/Main.elm rename to Part2.elm index a2d3f0c..e71ca36 100755 --- a/elmoji-translator-release-1/Main.elm +++ b/Part2.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part2 exposing (..) import Html import Html.Attributes diff --git a/elmoji-translator-release-2/Main.elm b/Part3.elm similarity index 98% rename from elmoji-translator-release-2/Main.elm rename to Part3.elm index 073e6dc..6244127 100755 --- a/elmoji-translator-release-2/Main.elm +++ b/Part3.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part3 exposing (..) import EmojiConverter import Html diff --git a/elmoji-translator-release-3-part-1/Main.elm b/Part4.elm similarity index 98% rename from elmoji-translator-release-3-part-1/Main.elm rename to Part4.elm index d18027c..c6ba016 100755 --- a/elmoji-translator-release-3-part-1/Main.elm +++ b/Part4.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part4 exposing (..) import EmojiConverter import Html diff --git a/elmoji-translator-release-3-part-2/Main.elm b/Part5.elm similarity index 99% rename from elmoji-translator-release-3-part-2/Main.elm rename to Part5.elm index 520f6ae..e13b0f5 100755 --- a/elmoji-translator-release-3-part-2/Main.elm +++ b/Part5.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part5 exposing (..) import EmojiConverter import Html diff --git a/elmoji-translator-release-4-part-1/Main.elm b/Part6.elm similarity index 99% rename from elmoji-translator-release-4-part-1/Main.elm rename to Part6.elm index 9626e92..feedd57 100755 --- a/elmoji-translator-release-4-part-1/Main.elm +++ b/Part6.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part6 exposing (..) import EmojiConverter import Html diff --git a/elmoji-translator-release-4-part-2/Main.elm b/Part7.elm similarity index 99% rename from elmoji-translator-release-4-part-2/Main.elm rename to Part7.elm index 2d5c727..b02952d 100755 --- a/elmoji-translator-release-4-part-2/Main.elm +++ b/Part7.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part7 exposing (..) import EmojiConverter import Html diff --git a/elmoji-translator-release-4-part-3/Main.elm b/Part8.elm similarity index 99% rename from elmoji-translator-release-4-part-3/Main.elm rename to Part8.elm index e8a823b..a1dbf86 100755 --- a/elmoji-translator-release-4-part-3/Main.elm +++ b/Part8.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Part8 exposing (..) import EmojiConverter import Html From 54b608811a621bfdb33926e506328256dc4a9a83 Mon Sep 17 00:00:00 2001 From: Aaron VonderHaar Date: Fri, 28 Sep 2018 15:59:44 -0700 Subject: [PATCH 3/4] Ignore .DS_Store --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 94c8b6d..4a76101 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /dist/ /elm-stuff/ /index.html +.DS_Store From c6955b63f3ef9fc559587eba5746104c90f6f984 Mon Sep 17 00:00:00 2001 From: Aaron VonderHaar Date: Fri, 28 Sep 2018 16:08:08 -0700 Subject: [PATCH 4/4] Configure Travis-CI (attempt #1) --- .gitignore | 2 ++ .travis.yml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 4a76101..a14ffbf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /elm-stuff/ /index.html .DS_Store +/node_modules/ +/package-lock.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e768267 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: false + +language: node_js +node_js: "10" + +install: + - npm install elm@elm0.18.0 + +script: + - npx elm-make --yes HelloWorld.elm + - npx elm-make --yes Part1.elm + - npx elm-make --yes Part2.elm + - npx elm-make --yes Part3.elm + - npx elm-make --yes Part4.elm + - npx elm-make --yes Part5.elm + - npx elm-make --yes Part6.elm + - npx elm-make --yes Part7.elm + - npx elm-make --yes Part8.elm