From 162c2188f4ae541784b98e93f77fa45d01eb67bb Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Mon, 24 Dec 2018 18:10:16 +0100 Subject: [PATCH] Sources -> New Form --- src/Applications/Brain/Authentication.elm | 4 +- src/Applications/UI/Backdrop.elm | 2 +- src/Applications/UI/Kit.elm | 128 +++++++-- src/Applications/UI/Kit/Classes.elm | 26 ++ src/Applications/UI/Navigation.elm | 19 +- src/Applications/UI/Page.elm | 14 +- src/Applications/UI/Sources.elm | 110 +++----- src/Applications/UI/Sources/Form.elm | 304 ++++++++++++++++++++++ src/Library/Replying.elm | 4 +- src/Library/Sources.elm | 48 +--- src/Library/Sources/Services/AmazonS3.elm | 20 +- src/Library/Sources/Services/Common.elm | 8 +- src/README.md | 15 ++ src/Static/Css/Application.css | 55 ++++ 14 files changed, 590 insertions(+), 167 deletions(-) create mode 100644 src/Applications/UI/Kit/Classes.elm create mode 100644 src/Applications/UI/Sources/Form.elm diff --git a/src/Applications/Brain/Authentication.elm b/src/Applications/Brain/Authentication.elm index d646f045..bfecd58f 100644 --- a/src/Applications/Brain/Authentication.elm +++ b/src/Applications/Brain/Authentication.elm @@ -155,7 +155,7 @@ noCmd = --- Json +-- JSON decodeMethod : J.Value -> Maybe Method @@ -167,7 +167,7 @@ decodeMethod json = --- Termination +-- TERMINATION type Termination diff --git a/src/Applications/UI/Backdrop.elm b/src/Applications/UI/Backdrop.elm index c8c81c19..3c77fa21 100644 --- a/src/Applications/UI/Backdrop.elm +++ b/src/Applications/UI/Backdrop.elm @@ -78,7 +78,7 @@ view model = ----------------------------------------- --- Private +-- PRIVATE ----------------------------------------- diff --git a/src/Applications/UI/Kit.elm b/src/Applications/UI/Kit.elm index 3cae58d3..0134872a 100644 --- a/src/Applications/UI/Kit.elm +++ b/src/Applications/UI/Kit.elm @@ -1,4 +1,4 @@ -module UI.Kit exposing (ButtonType(..), button, canister, colorKit, colors, defaultFont, h1, h2, headerFont, insulationWidth, intro, logoBackdrop, select, vessel) +module UI.Kit exposing (ButtonType(..), button, canister, centeredContent, colorKit, colors, defaultFont, h1, h2, h3, headerFont, insulationWidth, intro, label, link, logoBackdrop, select, textField, vessel) import Chunky exposing (..) import Color @@ -7,10 +7,11 @@ import Html.Attributes exposing (style) import Html.Events exposing (onClick, onInput) import Material.Icons.Hardware as Icons import Tachyons.Classes as T +import UI.Kit.Classes as C --- Colors +-- COLORS colorKit = @@ -30,12 +31,14 @@ colorKit = , base0D = rgb 6 182 239 , base0E = rgb 129 91 164 , base0F = rgb 233 107 168 + + -- ~(˘▾˘~) + , accent = rgb 248 164 167 } colors = { errorBorder = colorKit.base08 - , focusBorder = colorKit.base0D , inputBorder = rgb 225 225 225 , subtleBorder = rgb 238 238 238 , -- States @@ -51,7 +54,7 @@ rgb = --- Fonts +-- FONTS defaultFont : String @@ -65,7 +68,7 @@ headerFont = --- Space properties +-- SPACE PROPERTIES borderRadius : String @@ -78,8 +81,13 @@ insulationWidth = 840 +maxInputWidth : Float +maxInputWidth = + 360 + + --- Nodes +-- NODES type ButtonType @@ -94,13 +102,16 @@ button buttonType msg child = [ onClick msg -- - , style "border-color" (Color.toCssString colorKit.base0B) + , style "border-color" (Color.toCssString colorKit.accent) + , style "color" (Color.toCssString colorKit.accent) ] [ borderRadius + , C.buttonFocus , T.b__solid , T.bg_transparent , T.bw1 - , T.lh_solid + , T.f6 + , T.fw7 , T.ph3 , T.pointer , T.pv2 @@ -110,11 +121,13 @@ button buttonType msg child = slab Html.span [ style "font-size" "0" ] - [ T.dib, T.v_top ] + [ T.dib, T.lh_solid, T.v_top ] [ child ] WithText -> - child + chunk + [ T.lh_copy ] + [ child ] ] @@ -124,6 +137,28 @@ canister = [ T.mh1, T.ph3 ] +centeredContent : List (Html msg) -> Html msg +centeredContent children = + chunk + [ T.flex + , T.flex_grow_1 + , T.overflow_hidden + , T.relative + ] + [ logoBackdrop + , chunk + [ T.flex + , T.flex_column + , T.flex_grow_1 + , T.items_center + , T.justify_center + , T.relative + , T.z_1 + ] + children + ] + + h1 : String -> Html msg h1 text = slab @@ -162,6 +197,19 @@ h2 text = [ Html.text text ] +h3 : String -> Html msg +h3 text = + slab + Html.h2 + [ style "font-family" headerFont ] + [ T.f4 + , T.fw7 + , T.lh_title + , T.mb5 + ] + [ Html.text text ] + + intro : Html msg -> Html msg intro child = slab @@ -176,6 +224,30 @@ intro child = [ child ] +label : List (Html.Attribute msg) -> String -> Html msg +label attributes t = + slab + Html.label + (style "font-size" "11.25px" :: attributes) + [ T.db + , T.fw7 + , T.o_90 + , T.ttu + ] + [ Html.text t ] + + +link : { label : String, url : String } -> Html msg +link params = + slab + Html.a + [ Html.Attributes.href params.url + , style "border-bottom" ("2px solid " ++ Color.toCssString colorKit.accent) + ] + [ T.color_inherit, T.no_underline ] + [ Html.text params.label ] + + logoBackdrop : Html msg logoBackdrop = block @@ -198,11 +270,8 @@ logoBackdrop = select : (String -> msg) -> List (Html msg) -> Html msg select inputHandler options = block - [ style "border-bottom-color" (Color.toCssString colors.inputBorder) - , style "max-width" "360px" - ] - [ T.bb - , T.center + [ style "max-width" (String.fromFloat maxInputWidth ++ "px") ] + [ T.center , T.mb4 , T.relative , T.w_100 @@ -210,10 +279,13 @@ select inputHandler options = [ slab Html.select [ onInput inputHandler + , style "border-bottom" ("1px solid " ++ Color.toCssString colors.inputBorder) , style "color" (Color.toCssString colors.text) ] - [ T.bn + [ C.inputFocus + , T.bn , T.bg_transparent + , T.br0 , T.db , T.f5 , T.input_reset @@ -236,6 +308,30 @@ select inputHandler options = ] +textField : List (Html.Attribute msg) -> Html msg +textField attributes = + slab + Html.input + (List.append + [ style "border-bottom" ("1px solid " ++ Color.toCssString colors.inputBorder) + , style "color" (Color.toCssString colors.text) + , style "max-width" (String.fromFloat maxInputWidth ++ "px") + ] + attributes + ) + [ C.inputFocus + , T.bn + , T.bg_transparent + , T.db + , T.f6 + , T.lh_copy + , T.mt1 + , T.pv2 + , T.w_100 + ] + [] + + vessel : List (Html msg) -> Html msg vessel = block diff --git a/src/Applications/UI/Kit/Classes.elm b/src/Applications/UI/Kit/Classes.elm new file mode 100644 index 00000000..bd4a9853 --- /dev/null +++ b/src/Applications/UI/Kit/Classes.elm @@ -0,0 +1,26 @@ +module UI.Kit.Classes exposing (buttonFocus, inputFocus, navFocus, textFocus) + +{-| Additional CSS classes. +-} + +-- FOCUS + + +buttonFocus : String +buttonFocus = + "button-focus" + + +inputFocus : String +inputFocus = + "input-focus" + + +navFocus : String +navFocus = + "nav-focus" + + +textFocus : String +textFocus = + "text-focus" diff --git a/src/Applications/UI/Navigation.elm b/src/Applications/UI/Navigation.elm index b2b6fbeb..d145a2c3 100644 --- a/src/Applications/UI/Navigation.elm +++ b/src/Applications/UI/Navigation.elm @@ -11,6 +11,7 @@ import String.Format import Svg exposing (Svg) import Tachyons.Classes as T import UI.Kit +import UI.Kit.Classes as C import UI.Page as Page exposing (Page) @@ -37,7 +38,7 @@ type LabelType --- Global +-- GLOBAL global : List ( Page, String ) -> Page -> Html msg @@ -57,7 +58,7 @@ globalItem : Page -> Int -> Int -> ( Page, String ) -> Html msg globalItem activePage totalItems idx ( page, label ) = let isActivePage = - page == activePage + Page.sameBase page activePage isLastItem = idx + 1 == totalItems @@ -70,7 +71,7 @@ globalItem activePage totalItems idx ( page, label ) = , style "color" (ifThenElse isActivePage globalActiveColor globalDefaultColor) , style "border-bottom-color" (ifThenElse isActivePage globalBorderColor "transparent") ] - [ T.bb + [ C.textFocus , T.dib , T.lh_copy , T.no_underline @@ -78,6 +79,7 @@ globalItem activePage totalItems idx ( page, label ) = , T.pt2 -- + , ifThenElse isActivePage T.bb T.bn , ifThenElse isLastItem T.mr0 T.mr4 ] [ text label ] @@ -98,7 +100,7 @@ globalBorderColor = --- Local +-- LOCAL local : List ( Icon msg, Label, Action msg ) -> Html msg @@ -141,25 +143,24 @@ localItem idx ( Icon icon, Label labelText labelType, action ) = title "" -- + , style "border-bottom" "1px solid transparent" , style "border-right-color" localBorderColor , style "border-right-style" "solid" , style "border-right-width" (ifThenElse (idx == 0) "0" "1px") - , style "border-top" "1px solid transparent" + , style "border-top" "2px solid transparent" , style "color" localTextColor , style "height" "43px" ] [ ifThenElse (labelType == Hidden) T.flex_shrink_0 T.flex_grow_1 - - -- + , C.navFocus , T.bg_transparent - , T.bn + , T.bl_0 , T.fw6 , T.inline_flex , T.items_center , T.justify_center , T.lh_solid , T.no_underline - , T.outline_0 , T.pointer , T.ph3 ] diff --git a/src/Applications/UI/Page.elm b/src/Applications/UI/Page.elm index 2f5757d7..53be1cf2 100644 --- a/src/Applications/UI/Page.elm +++ b/src/Applications/UI/Page.elm @@ -1,4 +1,4 @@ -module UI.Page exposing (Page(..), fromUrl, toString) +module UI.Page exposing (Page(..), fromUrl, sameBase, toString) import Sources import Url exposing (Url) @@ -50,6 +50,18 @@ toString page = "/sources/new" +{-| Are the bases of these two pages the same? +-} +sameBase : Page -> Page -> Bool +sameBase a b = + case ( a, b ) of + ( Sources _, Sources _ ) -> + True + + _ -> + a == b + + -- ⚗️ diff --git a/src/Applications/UI/Sources.elm b/src/Applications/UI/Sources.elm index f06ddd5e..c39f35a4 100644 --- a/src/Applications/UI/Sources.elm +++ b/src/Applications/UI/Sources.elm @@ -2,17 +2,20 @@ module UI.Sources exposing (Model, Msg(..), initialModel, update, view) import Chunky exposing (..) import Html exposing (Html, text) -import Html.Attributes exposing (value) import Material.Icons.Content as Icons import Material.Icons.Navigation as Icons import Material.Icons.Notification as Icons import Replying exposing (R3D3) +import Return2 +import Return3 import Sources exposing (..) +import Sources.Services as Services import Tachyons.Classes as T import UI.Kit exposing (ButtonType(..), select) import UI.Navigation exposing (..) import UI.Page as Page import UI.Reply exposing (Reply(..)) +import UI.Sources.Form as Form @@ -20,12 +23,12 @@ import UI.Reply exposing (Reply(..)) type alias Model = - { form : Sources.Form } + { form : Form.Model } initialModel : Model initialModel = - { form = Sources.newForm + { form = Form.initialModel } @@ -35,14 +38,28 @@ initialModel = type Msg = Bypass + ----------------------------------------- + -- Children + ----------------------------------------- + | FormMsg Form.Msg update : Msg -> Model -> R3D3 Model Msg Reply update msg model = - ( model - , Cmd.none - , Nothing - ) + case msg of + Bypass -> + model + |> Return3.withNothing + + ----------------------------------------- + -- Children + ----------------------------------------- + FormMsg sub -> + model.form + |> Form.update sub + |> Return2.mapModel (\f -> { model | form = f }) + |> Return2.mapCmd FormMsg + |> Return3.withNoReply @@ -50,13 +67,15 @@ update msg model = view : Sources.Page -> Model -> Html Msg -view page = - case page of - Index -> - UI.Kit.vessel << index +view page model = + UI.Kit.vessel + (case page of + Index -> + index model - New -> - UI.Kit.vessel << new + New -> + List.map (Html.map FormMsg) (Form.new model.form) + ) @@ -94,68 +113,3 @@ index model = |> UI.Kit.intro ] ] - - - --- NEW - - -new : Model -> List (Html Msg) -new model = - case model.form.step of - Where -> - newWhere model.form - - _ -> - [ empty ] - - -newWhere : Form -> List (Html Msg) -newWhere { context } = - [ ----------------------------------------- - -- Navigation - ----------------------------------------- - UI.Navigation.local - [ ( Icon Icons.arrow_back - , Label "Back to list" Hidden - , GoToPage (Page.Sources Sources.Index) - ) - ] - - ----------------------------------------- - -- Content - ----------------------------------------- - , chunk - [ T.flex - , T.flex_grow_1 - , T.overflow_hidden - , T.relative - ] - [ UI.Kit.logoBackdrop - , chunk - [ T.flex - , T.flex_column - , T.flex_grow_1 - , T.items_center - , T.justify_center - , T.relative - , T.z_1 - ] - [ UI.Kit.h2 "Where is your music stored?" - - -- - , [ Html.option - [ value "AmazonS3" ] - [ text "Amazon S3" ] - ] - |> select (always Bypass) - |> chunky [ T.pv2, T.w_100 ] - - -- - , UI.Kit.button - WithIcon - Bypass - (Icons.arrow_forward UI.Kit.colorKit.base0B 17) - ] - ] - ] diff --git a/src/Applications/UI/Sources/Form.elm b/src/Applications/UI/Sources/Form.elm new file mode 100644 index 00000000..a238c96b --- /dev/null +++ b/src/Applications/UI/Sources/Form.elm @@ -0,0 +1,304 @@ +module UI.Sources.Form exposing (FormStep(..), Model, Msg(..), initialModel, new, takeStepBackwards, takeStepForwards, update) + +import Chunky exposing (..) +import Conditional exposing (..) +import Dict.Ext as Dict +import Html exposing (Html, strong, text) +import Html.Attributes exposing (for, name, placeholder, type_, value) +import List.Extra as List +import Material.Icons.Alert as Icons +import Material.Icons.Navigation as Icons +import Sources exposing (..) +import Sources.Services as Services +import Sources.Services.Common +import Tachyons.Classes as T +import UI.Kit exposing (ButtonType(..), select) +import UI.Navigation exposing (..) +import UI.Page as Page + + + +-- 🌳 + + +type alias Model = + { step : FormStep, context : Source } + + +type FormStep + = Where + | How + | By + + +initialModel : Model +initialModel = + { step = Where, context = defaultContext } + + +defaultContext : Source +defaultContext = + { id = "CHANGE_ME_PLEASE" + , data = Services.initialData defaultService + , directoryPlaylists = True + , enabled = True + , service = defaultService + } + + +defaultService : Service +defaultService = + AmazonS3 + + + +-- 📣 + + +type Msg + = SelectService String + | TakeStep + | TakeStepBackwards + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + ( ----------------------------------------- + -- Model + ----------------------------------------- + case msg of + SelectService serviceKey -> + case Services.keyToType serviceKey of + Just service -> + let + ( context, data ) = + ( model.context + , Services.initialData service + ) + in + { model | context = { context | data = data, service = service } } + + Nothing -> + model + + TakeStep -> + { model | step = takeStepForwards model.step } + + TakeStepBackwards -> + { model | step = takeStepBackwards model.step } + ----------------------------------------- + -- Command + ----------------------------------------- + , Cmd.none + ) + + +takeStepForwards : FormStep -> FormStep +takeStepForwards currentStep = + case currentStep of + Where -> + How + + _ -> + By + + +takeStepBackwards : FormStep -> FormStep +takeStepBackwards currentStep = + case currentStep of + By -> + How + + _ -> + Where + + + +-- NEW + + +new : Model -> List (Html Msg) +new model = + case model.step of + Where -> + newWhere model + + How -> + newHow model + + By -> + newBy model + + +newWhere : Model -> List (Html Msg) +newWhere { context } = + [ ----------------------------------------- + -- Navigation + ----------------------------------------- + UI.Navigation.local + [ ( Icon Icons.arrow_back + , Label "Back to list" Hidden + , GoToPage (Page.Sources Sources.Index) + ) + ] + + ----------------------------------------- + -- Content + ----------------------------------------- + , UI.Kit.centeredContent + [ UI.Kit.h2 "Where is your music stored?" + + -- Dropdown + ----------- + , Services.labels + |> List.map (\( k, l ) -> Html.option [ value k ] [ text l ]) + |> select SelectService + |> chunky [ T.pv2, T.w_100 ] + + -- Button + --------- + , UI.Kit.button + WithIcon + TakeStep + (Icons.arrow_forward UI.Kit.colorKit.accent 17) + ] + ] + + +newHow : Model -> List (Html Msg) +newHow { context } = + [ ----------------------------------------- + -- Navigation + ----------------------------------------- + UI.Navigation.local + [ ( Icon Icons.arrow_back + , Label "Take a step back" Shown + , PerformMsg TakeStepBackwards + ) + ] + + ----------------------------------------- + -- Content + ----------------------------------------- + , (\a -> + UI.Kit.centeredContent + [ chunk + [ T.w_100 ] + [ UI.Kit.canister a ] + ] + ) + [ UI.Kit.h3 "Where exactly?" + + -- Fields + --------- + , let + properties = + Services.properties context.service + + dividingPoint = + toFloat (List.length properties) / 2 + + ( listA, listB ) = + List.splitAt (ceiling dividingPoint) properties + in + chunk + [ T.flex ] + [ chunk + [ T.flex_grow_1, T.pr3 ] + (List.map (renderProperty context) listA) + , chunk + [ T.flex_grow_1, T.pl3 ] + (List.map (renderProperty context) listB) + ] + + -- Button + --------- + , chunk + [ T.mt3, T.tc ] + [ UI.Kit.button + WithIcon + TakeStep + (Icons.arrow_forward UI.Kit.colorKit.accent 17) + ] + ] + ] + + +newBy : Model -> List (Html Msg) +newBy { context } = + [ ----------------------------------------- + -- Navigation + ----------------------------------------- + UI.Navigation.local + [ ( Icon Icons.arrow_back + , Label "Take a step back" Shown + , PerformMsg TakeStepBackwards + ) + ] + + ----------------------------------------- + -- Content + ----------------------------------------- + , UI.Kit.centeredContent + [ UI.Kit.h2 "One last thing" + , UI.Kit.label [] "What are we going to call this source?" + + -- Input + -------- + , let + nameValue = + Dict.fetch "name" "" context.data + in + chunk + [ T.flex, T.mt4, T.justify_center, T.w_100 ] + [ UI.Kit.textField + [ name "name" + , value nameValue + ] + ] + + -- Note + ------- + , chunk + [ T.f6, T.flex, T.lh_title, T.mt5, T.o_50, T.tc ] + [ slab + Html.span + [] + [ T.mr1 ] + [ Icons.warning UI.Kit.colors.text 16 ] + , strong + [] + [ text "Make sure CORS is enabled" ] + ] + , chunk + [ T.f6, T.lh_title, T.mb5, T.mt2, T.o_50, T.tc ] + [ text "You can find the instructions over " + , UI.Kit.link { label = "here", url = "/about#CORS" } + ] + + -- Button + --------- + , UI.Kit.button + WithText + TakeStep + (text "Add source") + ] + ] + + + +-- PROPERTIES + + +renderProperty : Source -> Property -> Html Msg +renderProperty context property = + chunk + [ T.mb4 ] + [ UI.Kit.label [ for property.k ] property.l + , UI.Kit.textField + [ name property.k + , placeholder property.h + , type_ (ifThenElse property.p "password" "text") + , value (Dict.fetch property.k "" context.data) + ] + ] diff --git a/src/Library/Replying.elm b/src/Library/Replying.elm index 6150b5d7..d81c0279 100644 --- a/src/Library/Replying.elm +++ b/src/Library/Replying.elm @@ -40,7 +40,7 @@ return model msg = --- ⚡️ ~ Tasks +-- ⚡️ ~ TASKS do : msg -> Cmd msg @@ -50,7 +50,7 @@ do msg = ----------------------------------------- --- Private +-- PRIVATE ----------------------------------------- diff --git a/src/Library/Sources.elm b/src/Library/Sources.elm index 1c1574fc..6e40edea 100644 --- a/src/Library/Sources.elm +++ b/src/Library/Sources.elm @@ -1,4 +1,4 @@ -module Sources exposing (Form, FormStep(..), Page(..), Property, Service(..), Source, SourceData, defaultService, emptySource, newForm) +module Sources exposing (Page(..), Property, Service(..), Source, SourceData) import Dict exposing (Dict) @@ -21,10 +21,10 @@ type alias Source = type alias Property = - { prop : String - , labl : String - , plho : String - , pass : Bool + { k : String -- Key + , l : String -- Label + , h : String -- Placeholder + , p : Bool -- Password? } @@ -40,11 +40,6 @@ type Service = AmazonS3 -defaultService : Service -defaultService = - AmazonS3 - - -- PAGE @@ -52,36 +47,3 @@ defaultService = type Page = Index | New - - - --- FORM - - -type alias Form = - { step : FormStep, context : Source } - - -type FormStep - = Where - | How - | By - - -newForm : Form -newForm = - { step = Where, context = emptySource } - - - --- ⚡️ - - -emptySource : Source -emptySource = - { id = "CHANGE_ME_PLEASE" - , data = Dict.empty - , directoryPlaylists = True - , enabled = True - , service = defaultService - } diff --git a/src/Library/Sources/Services/AmazonS3.elm b/src/Library/Sources/Services/AmazonS3.elm index e34faee0..a5131af5 100644 --- a/src/Library/Sources/Services/AmazonS3.elm +++ b/src/Library/Sources/Services/AmazonS3.elm @@ -25,7 +25,8 @@ import Time defaults = - { directoryPath = "/" + { bucketName = "music" + , directoryPath = "/" , name = "Music from Amazon S3" , region = "eu-west-1" } @@ -35,15 +36,12 @@ defaults = -} properties : List Property properties = - [ { prop = "accessKey", labl = "Access key", plho = "Fv6EWfLfCcMo", pass = False } - , { prop = "secretKey", labl = "Secret key", plho = "qeNcqiMpgqC8", pass = True } - , { prop = "bucketName", labl = "Bucket name", plho = "music", pass = False } - , { prop = "region", labl = "Region", plho = defaults.region, pass = False } - , { prop = "directoryPath", labl = "Directory", plho = defaults.directoryPath, pass = False } - , { prop = "host", labl = "Host (optional)", plho = "http://127.0.0.1:9000", pass = False } - - -- - , nameProperty defaults.name + [ { k = "accessKey", l = "Access key", h = "Fv6EWfLfCcMo", p = True } + , { k = "secretKey", l = "Secret key", h = "qeNcqiMpgqC8", p = True } + , { k = "bucketName", l = "Bucket name", h = "music", p = False } + , { k = "region", l = "Region", h = defaults.region, p = False } + , { k = "directoryPath", l = "Directory", h = defaults.directoryPath, p = False } + , { k = "host", l = "Host (optional)", h = "http://127.0.0.1:9000", p = False } ] @@ -53,7 +51,7 @@ initialData : SourceData initialData = Dict.fromList [ ( "accessKey", "" ) - , ( "bucketName", "" ) + , ( "bucketName", defaults.bucketName ) , ( "directoryPath", defaults.directoryPath ) , ( "host", "" ) , ( "name", defaults.name ) diff --git a/src/Library/Sources/Services/Common.elm b/src/Library/Sources/Services/Common.elm index 7aec0ca8..15f8576c 100644 --- a/src/Library/Sources/Services/Common.elm +++ b/src/Library/Sources/Services/Common.elm @@ -11,10 +11,10 @@ import String.Ext as String nameProperty : String -> Property nameProperty placeholder = - { prop = "name" - , labl = "Name" - , plho = placeholder - , pass = False + { k = "name" + , l = "Name" + , h = placeholder + , p = False } diff --git a/src/README.md b/src/README.md index c048f706..b0e3389c 100644 --- a/src/README.md +++ b/src/README.md @@ -7,3 +7,18 @@ Elm directories: - Library `UI` is the Elm application that'll be executed on the main thread (ie. the UI thread) and `Brain` is the Elm application that'll live inside a web worker. `UI` will be the main application and `Brain` does the heavy lifting. The code shared between these two applications lives in `Library`. + + + +## Emoji Comments + +``` +⛩ Gates (Flags & Ports) +🌳 Types & Initial State +📣 Updates +📰 Subscriptions +🗺 Views + +🧠 Brain +⚡️ Functions +``` diff --git a/src/Static/Css/Application.css b/src/Static/Css/Application.css index aed146ad..45dfcaf4 100644 --- a/src/Static/Css/Application.css +++ b/src/Static/Css/Application.css @@ -1,3 +1,10 @@ +:root { + --focus-color: black; + --placeholder-color: black; +} + + + body { background-color: #02070E; background-image: url("/images/ep_naturalblack_pattern.jpg"); @@ -11,6 +18,54 @@ body { +/************ + * Focusing * + ************/ + +.button-focus:focus, +.input-focus:focus, +.nav-focus:focus, +.text-focus:focus { + outline: none; +} + +.button-focus:focus:not(:active) { + border-color: var(--focus-color) !important; + color: var(--focus-color) !important; +} + +.nav-focus:focus:not(:active) { + border-top-color: var(--focus-color) !important; +} + +.input-focus:focus { + border-bottom-color: var(--focus-color) !important; +} + +.text-focus:focus:not(:active) { + border-bottom-color: rgba(0, 0, 0, 0.475) !important; + color: black !important; +} + +.button-focus:focus:not(:active) svg > g, +.text-focus:focus:not(:active) svg > g { + fill: var(--focus-color) !important; +} + + + +/*************** + * Placeholder * + ***************/ + +::-webkit-input-placeholder { color: var(--placeholder-color); opacity: 0.2; } +::-moz-placeholder { color: var(--placeholder-color); opacity: 0.2; } +:-ms-input-placeholder { color: var(--placeholder-color); opacity: 0.2; } +:-moz-placeholder { color: var(--placeholder-color); opacity: 0.2; } +::placeholder { color: var(--placeholder-color); opacity: 0.2; } + + + /************ * Backdrop * ************/ -- knotmirror 0.0.1