mirror of
https://github.com/correl/elm-mdl.git
synced 2024-11-23 11:09:51 +00:00
misc
This commit is contained in:
parent
bb8e2d6419
commit
32626b09e9
4 changed files with 22 additions and 21 deletions
6
Makefile
6
Makefile
|
@ -1,4 +1,4 @@
|
|||
PAGES=../../elm-mdl-gh-pages
|
||||
PAGES=../elm-mdl-gh-pages
|
||||
|
||||
comp:
|
||||
elm-make examples/Component.elm --warn --output elm.js
|
||||
|
@ -10,11 +10,11 @@ docs:
|
|||
elm-make --docs=docs.json
|
||||
|
||||
wip-pages :
|
||||
(cd demo; elm-make Demo.elm --output $(PAGES)/wip.js)
|
||||
(cd demo; elm-make Demo.elm --output ../$(PAGES)/wip.js)
|
||||
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
||||
|
||||
pages :
|
||||
elm-make examples/Demo.elm --output $(PAGES)/elm.js
|
||||
(cd demo; elm-make Demo.elm --output ../$(PAGES)/elm.js)
|
||||
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
||||
|
||||
cleanish :
|
||||
|
|
|
@ -152,8 +152,10 @@ body1 t srcUrl contents links demo =
|
|||
]
|
||||
|
||||
|
||||
body2 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
||||
body2 = body1
|
||||
|
||||
|
||||
body3 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
||||
body3 t srcUrl contents links demo =
|
||||
div
|
||||
|
|
|
@ -160,7 +160,7 @@ view addr model =
|
|||
|> List.map (\c ->
|
||||
cell
|
||||
[size All 4, offset Desktop 1]
|
||||
[c.view addr model.mdl]
|
||||
[c.view addr model.mdl []]
|
||||
)
|
||||
|> List.intersperse (cell [size All 1] [])
|
||||
|> grid []
|
||||
|
|
|
@ -46,6 +46,7 @@ import Html.Events exposing (..)
|
|||
import Effects
|
||||
|
||||
import Material.Helpers exposing (filter)
|
||||
import Material.Style as Style exposing (cs, cs', Style)
|
||||
import Material.Component as Component exposing (Indexed)
|
||||
|
||||
|
||||
|
@ -138,25 +139,23 @@ update action model =
|
|||
|
||||
{-| Component view.
|
||||
-}
|
||||
view : Signal.Address Action -> Model -> Html
|
||||
-- TODO: Should take Style argument.
|
||||
view addr model =
|
||||
view : Signal.Address Action -> Model -> List Style -> Html
|
||||
view addr model styles =
|
||||
let hasFloat = model.label |> Maybe.map .float |> Maybe.withDefault False
|
||||
hasError = model.error |> Maybe.map (always True) |> Maybe.withDefault False
|
||||
labelText = model.label |> Maybe.map .text
|
||||
in
|
||||
filter div
|
||||
[ classList
|
||||
[ ("mdl-textfield", True)
|
||||
, ("mdl-js-textfield", True)
|
||||
, ("is-upgraded", True)
|
||||
, ("mdl-textfield--floating-label", hasFloat)
|
||||
, ("is-invalid", hasError)
|
||||
, ("is-dirty", model.value /= "")
|
||||
, ("is-focused", model.isFocused && not model.isDisabled)
|
||||
, ("is-disabled", model.isDisabled)
|
||||
]
|
||||
]
|
||||
filter Style.div
|
||||
( cs "mdl-textfield"
|
||||
:: cs "mdl-js-textfield"
|
||||
:: cs "is-upgraded"
|
||||
:: cs' "mdl-textfield--floating-label" hasFloat
|
||||
:: cs' "is-invalid" hasError
|
||||
:: cs' "is-dirty" (model.value /= "")
|
||||
:: cs' "is-focused" (model.isFocused && not model.isDisabled)
|
||||
:: cs' "is-disabled" model.isDisabled
|
||||
:: styles
|
||||
)
|
||||
[ Just <| input
|
||||
[ class "mdl-textfield__input"
|
||||
, style [ ("outline", "none") ]
|
||||
|
@ -191,7 +190,7 @@ type alias Container c =
|
|||
{-|
|
||||
-}
|
||||
type alias Instance container obs =
|
||||
Component.Instance Model container Action obs Html
|
||||
Component.Instance Model container Action obs (List Style -> Html)
|
||||
|
||||
|
||||
{-| Component constructor. See module `Material`.
|
||||
|
@ -199,7 +198,7 @@ type alias Instance container obs =
|
|||
instance :
|
||||
Int
|
||||
-> (Component.Action (Container c) obs -> obs)
|
||||
-> Model
|
||||
-> Model
|
||||
-> List (Component.Observer Action obs)
|
||||
-> Instance (Container c) obs
|
||||
|
||||
|
|
Loading…
Reference in a new issue